dart_smb2 0.1.0
dart_smb2: ^0.1.0 copied to clipboard
Dart client for SMB2/3 built on libsmb2. Supports listing, reads, writes, streaming, caching, worker pool with reconnect and more. Targets macOS, Windows, Linux, iOS and Android.
0.1.0 28-05-2026 #
Changed #
- General refactor of the code.
- Rewrote the FFI layer with ffigen and simplified the internals; temporary native memory is now freed automatically.
Smb2Client.open()no longer takes a path; the native library already loads automatically.
Removed #
CachedSmb2Pooland built-in caching. The pool no longer cachesstat/listDirectory— cache at your own layer if you need to.
Fixed #
listDirectoryandlistSharesnow work correctly on 32-bit Android.readlinkhandles long symlink targets correctly.- File paths containing NUL characters are rejected instead of being silently cut short.
- Pool operations no longer hang if a worker dies mid-request — they fail fast and reconnect.
- Interrupted downloads now raise an error instead of finishing short and silent.
- Several handle and reconnect edge cases under heavy concurrency are handled cleanly.
0.0.7 25-05-2026 #
Docs #
- Branding realignment with the rest of the libraries.
Build #
- Improvements to Swift Package Manager on both iOS and macOS.
- iOS and macOS now ship a dynamic xcframework.
- Bumped minimum deployment targets to iOS
15.0and macOS12.0. - Added Android
armeabi-v7a(32-bit ARM), Linuxaarch64and Windowsarm64binaries. - Updated libs to
libsmb2-r5across all platforms.
0.0.6 24-04-2026 #
Added #
Smb2Pool.withFile(path, body, {knownSize})and scopedSmb2File— opens a read handle, runs the callback, guaranteescloseHandleon any exit (exception, early return, cancellation). Replaces theopenFileWithSize+readFromHandle+closeHandleboilerplate at every call site.Smb2Pool.downloadToFile(path, File destFile, {chunkSize, onProgress, isCanceled})— one-call download of an SMB file to a localFilestreaming through a single persistent handle.onProgress(received, total)andisCanceled()callbacks toSmb2Pool.streamFile. Cancellation throwsSmb2Exception; the handle is always closed.FinalizeronSmb2PoolHandlethat best-effort-closes handles leaked by the caller. Safety net only — prefer explicitcloseHandleorwithFilefor deterministic cleanup.
Fixed #
streamFilewas implemented on top ofreadFileRange, which doesopen + pread + closeper chunk — a 50 MiB read in 1 MiB chunks meant 50 SMB2 Create/Close pairs on the wire. It now uses a single persistent handle (1 Create + N Reads + 1 Close) and chunks at libsmb2's server-negotiatedMaxReadSize.Smb2Pool.fsyncHandleandftruncateHandlenow go through the auto-reconnect path. A disconnect mid-operation previously surfaced a raw worker-send failure instead of a clean reconnect + retry.closeHandleis idempotent; calling it twice on the same handle is a no-op (previously it would fail with "Invalid handle" on the second call).
Removed #
Smb2Isolate. It duplicatedSmb2Pool(workers: 1)with a divergent error format and no auto-reconnect. UseSmb2Pool.connect(..., workers: 1)instead.
Docs #
- Rewrote the README around
Smb2Poolas the default entry point. New sections: Scoped File Access (withFile), Download to File, Low-Level File Handles.
Example #
- New demo cards in the example app for
withFile,downloadToFile,openFileWithSize,fsyncHandle, and an Error Classification card that exercisesstat/exists/deleteFileon missing paths and reports the resolvedSmb2ErrorType. WiredonProgressinto thestreamFilecard.
Build #
- Patched libsmb2's completion callbacks (
create_cb_1,fstat_cb_1,getinfo_cb_3,trunc_cb_3,rename_cb_3,ftrunc_cb_1) to populate the NT error on the context viasmb2_set_nterror. Previouslystat/exists/mkdir/rmdir/deleteFile/rename/truncate/ftruncatesilently surfaced asSmb2ErrorType.unknownwitherrno=0and an empty message on any failure — soexists()could not detectfileNotFoundandmkdir()could not detectalreadyExists. - Updated binaries to
libsmb2-r4.
0.0.4 12-04-2026 #
Fixed #
- Linux
libsmb2.sowas built as ARM64 (Docker default on Apple Silicon) and failed to load on x86_64 hosts; build now forces--platform=linux/amd64. - Windows
libsmb2.dllhad unbundled MinGW runtime dependencies (libgcc_s_seh-1.dll,libwinpthread-1.dll); now statically linked with-static -static-libgcc. Smb2Exception: Poll failedon Android and Linux during connect — patched libsmb2sync.cto retrypoll()onEINTR(signals from ART/Dart VM were aborting the syscall).
Build #
- Updated binaries to
libsmb2-r3.
0.0.3 12-04-2026 #
Fixed #
- Transport failures (
POLLHUP,POLLERR, socket read/write errors, connect failures, lost tree-id after server-side idle teardown, …) now classify asSmb2ErrorType.connectioninstead ofunknown.
0.0.2 09-04-2026 #
Added #
- Write operations, write handles, file management (
mkdir,rmdir,deleteFile,rename,truncate), filesystem info (statvfs,readlink,echo,fsync,ftruncate,exists), security options (seal,signing,version),Smb2Versionenum,Smb2StatVfstype.
Fixed #
- libsmb2 thread safety mutex, zero-copy isolate transfers,
Smb2Isolate.disconnect()graceful shutdown,streamWriteno retry on failure, unified error encoding, write loop infinite hang,fileSize()now throws,truncate()negative length validation, allocator consistency,listdircapacity overflow,TransferableTypedDatafresh per retry.
Example #
- Flutter app with server management, 12 read demo cards, 10 write demo cards.
Build #
- Updated binaries to
libsmb2-r2.
