dart_smb2
0.4.1, released 6 days ago by ales-drnz.com
Dart and Flutter client for SMB2 and SMB3 file shares built on libsmb2.
What it does
Connects to SMB2 and SMB3 file shares, Samba, Windows, and NAS servers. It allows you to list directories, stream reads, perform atomic downloads and uploads, copy files, and watch directory changes across multiple worker isolates.
AI-written summary of version 0.4.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to access, read, download, or upload files to a network share or NAS from a Dart or Flutter app.
- You want background worker isolates to handle SMB requests so the UI thread remains unblocked.
Skip it when
- You only need local device storage or cloud-hosted backends like Firebase or Supabase.
Strengths
- Runs requests on worker isolates to prevent blocking the UI thread.
- Supports automatic reconnection and retry mechanisms for dropped connections.
- Bundles precompiled libsmb2 binaries with static cryptographic linking for multiple platforms.
Weaknesses
- Requires network access during the first build to download and verify native libsmb2 binaries.
- Adds significant app size due to bundled OpenSSL libcrypto support.
Setup
- Kind
- FFI (native library)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 5
Requires INTERNET permission on Android and network client entitlements on macOS. The first build needs network access to download native binaries.
import 'package:dart_smb2/dart_smb2.dart';
Future<void> main() async {
final pool = await Smb2Pool.connect(
host: '192.168.1.10',
share: 'Music',
user: 'alice',
password: 'secret',
);
try {
for (final entry in await pool.listDirectory('')) {
print('${entry.name} ${entry.isDirectory ? 'dir' : '${entry.size} B'}');
}
} finally {
await pool.disconnect();
}
}Alternatives
Packages that do the same job and could replace dart_smb2.
- flutter_downloader
Plugin to create and manage background download tasks on Android and iOS.
80Compare
Works with
Packages commonly used together with dart_smb2: ones it builds on, ones built on it, and its own family.
- cryptodart_smb2 depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- hooksdart_smb2 depends on itDart API for the JSON-based protocol for package build and link hooks.
- code_assetsdart_smb2 depends on itProvides the hook protocol specification for bundling native code with Dart packages.
- ffidart_smb2 depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- dart_jellyfinSame familyDart client for Jellyfin media servers with authentication, browsing, and streaming.
- dart_plexSame familyDart client for Plex Media Server and plex.tv supporting sign-in, libraries, streaming, and search.