xue_hua_navite_cache_manager 1.3.0
xue_hua_navite_cache_manager: ^1.3.0 copied to clipboard
Flutter native network file cache with CachedNetworkImage, HTTP 304 revalidation, LRU/LFU/FIFO/TTL eviction, MD5/SHA-256 checksums, and progress.
1.3.0 #
- Migrated native platform communication from manual
MethodChannel/EventChannel+plugin_platform_interfaceto Pigeon Native Interop:- iOS & macOS (
ios/,macos/): Independent Pigeon Swift FFI (useFfi: true) +@FlutterApiprogress callbacks via@asynclistener bindings, eliminatingDispatchQueue.main.syncdeadlocks onURLSessioncreation and keepingcancelDownloadlock-free from disk I/O. - Android (
android/): Pigeon Kotlin JNI (useJni: true) with coroutinesuspendhost handlers and daemon progress dispatching. - Windows (
windows/) & Linux (linux/): Pigeon C++ and GObject channel handlers generated frompigeons/cache_messages.dart, moving disk/index work onto bounded worker pools and dispatching progress events on platform threads. - Dart (
lib/): Removedplugin_platform_interfaceand manual channel boilerplate, introducing an internalCacheBackendinterface (PigeonCacheBackendon native platforms,XueHuaNaviteCacheManagerWebon Web) while preserving 100% public Dart API compatibility.
- iOS & macOS (
1.2.0 #
- Added high-performance
borderRadiussupport (BorderRadiusGeometry?) toCachedNetworkImage. Rounded corners are rendered directly on the canvas via a custom leafRenderBox(ui.ImageShader+Canvas.drawRRectsingle-pass GPU draw call with shader caching) without allocating heavyweightClipRRect/Containerwidgets,ClipRRectLayercompositing layers, orsaveLayeroffscreen buffers during fade-in transitions. - Fixed
CachedNetworkImage.imageBuilderrendering blank (0x0layout collapse) when returning a childlessContainerwithBoxDecoration(image: DecorationImage(image: imageProvider)):- Preserved
CachedNetworkImage'swidthandheightconstraints on theimageBuildersubtree and added decodedui.Imageintrinsic-dimensionLimitedBoxfallbacks when placed inside unbounded parents (Column,Row,ListView,SingleChildScrollView). - Shared active
ImageStreamCompleterinstances inCachedNetworkImageProviderwhile mounted soDecorationImageinsideimageBuilderresolves synchronously from the already-decoded frame without duplicate decoding or network requests. - Prevented late asynchronous
chunkEventsfrom overridingloadingBuilderafter the first frame has decoded, and ensured fade-in animations paint on frame 0 soRenderDecoratedBoxresolvesDecorationImageimmediately.
- Preserved
- Breaking Change: Renamed
CachedNetworkImage.errorWidgettoCachedNetworkImage.errorBuilderto align with Flutter'sImage.errorBuildernaming convention.
1.1.6 #
- Example Fetch, preset, and gallery URLs no longer use
flutter.github.ioorpicsum.photos. Android API 24 rejects those certificate chains (CertPathValidatorException: Trust anchor). Default Fetch ishttps://httpbin.org/image/jpeg, sample images arehttps://www.gstatic.com/webp/gallery/1.jpgand2.jpg, the sample video ishttps://filesamples.com/samples/video/mp4/sample_640x360.mp4, and the other gallery slots are distincthttps://placehold.co/JPEGs. - Expanded example
integration_testcoverage, silencedavoid_printin the driver entrypoint, and disabled the Xcode quoted-include warning in the example iOS project. - Restored Android background-executor delivery for
clearAll/trimToSize/removeByTag/removeExpired/removeFile/listEntries/getStatsso it matches the 1.1.5 pub.dev build (main had drifted after the 1.1.5–1.1.10 collapse).
1.1.5 #
- Aggregates unpublished work since 1.1.4.
- Fixed iOS simulator Fetch after the download itself succeeds. 1.1.9 capped TLS at 1.2, so CFNetwork finishes the owl GET (HTTP/2, status 200). The example still never showed Last Fetch Result: the simulator session had an empty
URLSessionDelegate, andURLSession.data(for:)resumes only through that delegate. The anchor implements no task callbacks, so the async continuation never ran,finishNetworkDownload/finishInFlightnever ran, and the main-queueFlutterResultwas never posted. The driver poll (~45s) also ends before the 46s watchdog, which is why Download error did not appear either. The simulator now uses a delegate-freedataTaskcompletion handler. That handler is what URLSession calls when the task finishes; it hops to the download queue,finishNetworkDownloadstores the file, andfinishInFlightruns the waiter, which callsFlutterResulton the main thread. Device downloads still use the delegatedownloadTask. macOS and Windows are unchanged. - Fixed iOS simulator Fetch so the example can show Last Fetch Result.
assumesHTTP3Capable = falsedoes not disable HTTP/3 (it is the default), so the iOS 27 simulator still tried QUIC and the download never finished.downloadTaskcompletion handlers anddidCompleteWithErrorwere both silent, sodownloadFilenever replied. The simulator session now caps TLS at 1.2 (HTTP/1.1 only) and loads the body withURLSession.data(for:)on an explicit serial delegate queue.finishNetworkDownloadthen postsFlutterResulton the main queue, which is what the example turns into Last Fetch Result (or Download error). Devices still stream with a delegatedownloadTask. macOS is unchanged. - Fixed iOS compilation. The
main.asyncclosure that starts the first download used optional chaining (self?.resumeDownloadTask), so its type was() -> ()?andDispatchQueue.async(execute:)selected theDispatchWorkItemoverload. The hop is now aVoidclosure. The 1.1.7 download-completion behavior is unchanged. - Fixed iOS simulator
downloadFilenever completing. Delegate-basedURLSessionDownloadTaskdid not deliverdidCompleteWithErroron the simulator (macOS on the same commit did), and the watchdog calledtask.cancel()before scheduling its fallback, so a stuck session queue swallowed the timeout. iOS now uses a completion-handler download task, creates the firstURLSessionon the main thread withoutDispatchQueue.main.sync, and on the simulator uses an ephemeral session with HTTP/3 disabled so the request is not stuck in the simulator HTTP stack. - Fixed Darwin plugin compilation.
permitKeyswas initialized with a dictionary literal ([:]), which Swift cannot use forSet<String>. Both iOS and macOS now use an empty set ([]), so the 1.1.5 plugins build again. - Fixed Darwin
flutter_driverstalls after the example gallery scrolls.flutter_driverwaitFordoes not search untiltransientCallbackCountis 0. The gallery's indeterminateCircularProgressIndicator(noContent-Lengthyet) and the status banner's indeterminateLinearProgressIndicator(latest eventstarted/failed/canceled) never stop ticking, so every latertapTexthit the 20s command timeout while the isolate itself stayed alive. Loading placeholders are now static unless byte progress is known, and the banner never passes a null progress value. - Fixed iOS
URLSessionstartup. The session was first created on a GCD worker insidedownloadFile; CFNetwork can abort the process from that thread, which matches the simulator fetch dying beforeLast Fetch Resultand the Dart VM restarting. The session is now created on the main thread, withwaitsForConnectivity = false, explicit request/resource timeouts, and a background delegate queue. - Darwin downloads stream to disk with
URLSessionDownloadTaskinstead of buffering the whole body in adataTask. Progress events are throttled to 50ms and include the expected byte count. A watchdog cancels a task that never completes and releases its download permit exactly once. Nil fields are omitted from event and download payloads so the iOS codec does not seeNSNull. - iOS index load now recovers orphaned cache files when
cache_index_v1.jsonis missing, matching macOS, and ignores in-flight.partialdownloads.
1.1.4 #
- Fixed Windows platform-thread delivery for the event channel and download method results.
EventSinkandMethodResultare no longer invoked from WinHTTP worker threads. Flutter 3.50 and newer SDKs usePluginRegistrarWindows::PostPlatformThreadTaskwhen that API is present; earlier 3.47+ SDKs post to a message-only window created on the platform thread, which is the thread the engine requires. - Throttled Windows
inProgressevents to one per 50ms so gallery downloads do not flood the platform thread. - Windows cache-index writes are now debounced (600ms) and flushed off the platform thread, matching the documented 10,000-entry index engine, so the example stress benchmark does not rewrite the full index on every
putBytes. - Replaced deprecated
package:flutter/material.dartimports withpackage:material_ui/material_ui.dart(material_ui: ^1.0.0) so rootflutter analyzeis clean on Flutter 3.47+.
1.1.3 #
- Corrected the example integration test checksum expectation for the loopback payload.
- Added an example flutter_driver UI harness under
example/test_driver/. - Fixed Linux conditional HTTP revalidation. Downloads now store
ETagandLast-Modified, and an HTTP304 Not Modifiedresponse is reported asrevalidatedinstead of anothernetworkDownload.
1.1.2 #
- Shortened the pubspec
descriptionso it meets pub.dev's 60–180 character guidance and search engines can show the full text.
1.1.1 #
- Fixed Windows
CMakeLists.txtnative-test gate:if(FALSE AND ${include_..._tests})expanded to invalidif(FALSE AND)when the variable was unset, breaking host appflutter build windows.
1.1.0 #
- Added a bounded native download concurrency pool controlled by
maxConcurrentDownloadsacross Android, iOS, macOS, Windows, Linux, and Web, so large batches (e.g. 100+ images) stay controlled instead of flooding the network stack. - Reworked iOS/macOS downloads to pure async
URLSessioncompletion callbacks with a download permit queue (removed blockingsemaphore.wait()on GCD workers). - Made
prefetchAllrun through the same bounded concurrent pool on every platform instead of serial one-by-one downloads. - Added in-flight request deduplication by cache key on native platforms and in Dart
downloadFile, so concurrent callers for the same URL/key share one network transfer and fan out one result. - Moved Windows WinHTTP and Linux curl downloads onto background worker threads so MethodChannel / UI threads are no longer blocked during transfers.
- Fixed Windows
cancelDownloadso custom keys that are still only in the in-flight table (not yet indexed) can be canceled, matching Linux/Apple/Android behavior. - Added
CachedNetworkImagewidget andCachedNetworkImageProviderfor high-performance, zero-jank 60/120 FPS network image rendering and caching across all 6 platforms. - Implemented zero-copy native file decoding (
ui.ImmutableBuffer.fromFilePath) and C++ codec target-size downsampling (memCacheWidth,memCacheHeight,maxWidth,maxHeight) to prevent GPU/RAM spikes on high-resolution images. - Added synchronous
ImageCachefast-path short-circuiting (wasSynchronouslyLoaded) to eliminate fade-in flicker during rapid list/grid scrolling. - Upgraded cache index engine across Android, iOS, macOS, Windows, Linux, and Web to support 10,000+ cached entries (
maxEntriesdefault raised to20,000) withO(1)running byte quota tracking, 600ms debounced asynchronous disk flushing, and 50ms progress event throttling. - Split data models and enums into dedicated modular files under
lib/src/models/. - Added a 5-tab example workbench featuring a
CachedNetworkImagegallery and a 10,000+ entries stress benchmark, along with comprehensive unit, widget, and performance test suites.
1.0.0 #
- Initial stable release of
xue_hua_navite_cache_manageracross Android, iOS, macOS, Windows, Linux, and Web. - Added
XueHuaNaviteCacheManager.instanceunified API with global configuration (CacheManagerConfig). - Added network file downloading and caching (
downloadFile,getSingleFile,prefetch,prefetchAll,cancelDownload) with conditional HTTPETag/Last-Modified(304 Not Modified) revalidation andCache-Control: max-ageparsing. - Added native MD5 and SHA-256 checksum verification (
CacheChecksumAlgorithm). - Added configurable disk quota eviction policies (
LRU,LFU,FIFO,TTL-only) and pinned entry protection (setPinned). - Added manual cache insertion and reading (
putBytes,putFile,getFileFromCache,readCacheBytes,containsKey). - Added selective and bulk eviction (
removeFile,removeByTag,removeExpired,trimToSize,clearAll) and real-time analytics (getStats,listEntries,getCapabilities,progressStream,watchProgress).