Skip to content
pubscout

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.

$ flutter pub add dart_smb2
Source repository

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.

Works with

Packages commonly used together with dart_smb2: ones it builds on, ones built on it, and its own family.