baseflow / flutter_cache_manager Goto Github PK
View Code? Open in Web Editor NEWGeneric cache manager for flutter
Home Page: https://baseflow.com
License: MIT License
Generic cache manager for flutter
Home Page: https://baseflow.com
License: MIT License
Hello dev:
Sometimes relativePath
field will be null in data/data/com.abc.xyz/databases/libCachedImageData.db
.
It will make the data/data/com.abc.xyz/libCachedImageData
create as File
(not folder), so flutter app crash at putFile(cachedObj)
in next cache operation .
But i cannot reappear it.
so i track the code maybe this line cause it:
During the rendering of this code, which uses the streetViewUrl
variable (an url to the StreetView api of Google like "https://maps.googleapis.com/maps/api/streetview" )
child: new Stack(
children: <Widget>[
new Positioned.fill(
child: new CachedNetworkImage(
imageUrl: streetViewUrl,
fit: BoxFit.cover,
placeholder: new Center(
child: CircularProgressIndicator(),
),
errorWidget: new Center(
child: new Icon(
MdiIcons.gasStation,
color: Colors.white70,
size: 60.0,
),
),
),
)
],
),
the plugin raises current error:
JsonUnsupportedObjectError: Converting object to an encodable object failed: _LinkedHashMap len:1
File "json.dart", line 705, in _JsonStringifier.writeObject
File "json.dart", line 904, in _JsonStringStringifier.printOn
File "json.dart", line 886, in _JsonStringStringifier.stringify
File "json.dart", line 287, in JsonEncoder.convert
File "flutter_cache_manager.dart", line 115, in CacheManager._saveDataInPrefs
File "<asynchronous suspension>"
File "flutter_cache_manager.dart", line 81, in CacheManager._save
File "<asynchronous suspension>"
File "flutter_cache_manager.dart", line 253, in CacheManager.getFile
File "<asynchronous suspension>"
File "cached_network_image.dart", line 472, in CachedNetworkImageProvider._loadAsync
File "<asynchronous suspension>"
File "cached_network_image.dart", line 462, in CachedNetworkImageProvider.load
File "image_provider.dart", line 265, in ImageProvider.resolve.<fn>.<fn>
File "image_cache.dart", line 82, in ImageCache.putIfAbsent
File "image_provider.dart", line 265, in ImageProvider.resolve.<fn>
File "synchronous_future.dart", line 38, in SynchronousFuture.then
File "image_provider.dart", line 263, in ImageProvider.resolve
File "decoration_image.dart", line 239, in DecorationImagePainter.paint
File "box_decoration.dart", line 395, in _BoxDecorationPainter._paintBackgroundImage
File "box_decoration.dart", line 413, in _BoxDecorationPainter.paint
File "proxy_box.dart", line 1887, in RenderDecoratedBox.paint
File "object.dart", line 2018, in RenderObject._paintWithContext
File "object.dart", line 130, in PaintingContext.paintChild
File "proxy_box.dart", line 127, in _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 2018, in RenderObject._paintWithContext
File "object.dart", line 130, in PaintingContext.paintChild
File "proxy_box.dart", line 127, in _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 2018, in RenderObject._paintWithContext
File "object.dart", line 130, in PaintingContext.paintChild
File "proxy_box.dart", line 127, in _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 2018, in RenderObject._paintWithContext
File "object.dart", line 130, in PaintingContext.paintChild
File "box.dart", line 2207, in _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultPaint
File "stack.dart", line 604, in RenderStack.paintStack
File "stack.dart", line 612, in RenderStack.paint
the pubspec.lock versions are:
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.2"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
I'm getting an error while executing flutter packages get
ERROR
Running "flutter packages get" in myapp...
The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.
Because uuid 0.5.3 requires SDK version >=1.0.0 <2.0.0 and no versions of uuid match >0.5.3 <0.6.0, uuid ^0.5.3 is forbidden.
Thus, cached_network_image ^0.4.1+1 is forbidden.
So, because myapp depends on flutter_cache_manager , version solving failed.
pub get failed (1)
exit code 1
Using Dependencies
charts_flutter: ^0.4.0
sqflite: ^0.11.2+2
path_provider: ^0.4.1
http: ^0.11.3+17
video_player: ^0.6.4
barcode_scan: ^0.0.6
url_launcher: ^3.0.3
connectivity: ^0.3.1
cached_network_image: ^0.4.1+1
flutter_html_view: ^0.5.5
firebase_messaging: ^1.0.5
launch_review: ^1.0.1
image_picker: ^0.4.8
shared_preferences: ^0.4.2
async_loader: ^0.1.2
Flutter & IDE ```
VS Code Version: 1.26.1
Flutter 0.6.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 9299c02cf7 (2 weeks ago) • 2018-08-16 00:35:12 +0200
Engine • revision e3687f70c7
Tools • Dart 2.1.0-dev.0.0.flutter-be6309690f
I added the flutter_cache_manager: "^0.1.0" to my project pubspec.yaml and get an error below when I ran the flutter packages get command.
Running "flutter packages get" in MyApp...
Package flutter_cache_manager has no versions that match >=0.1.0 <0.2.0 derived from:
After upgrading to the latest cache manager and cached image, i am seeing a lot of exceptions in our sentry error log like this one:
ClientException: Connection closed while receiving data
File "cache_manager.dart", line 120, in BaseCacheManager.getFile
File "<asynchronous suspension>"
File "cached_image_widget.dart", line 261, in CachedNetworkImageState._animatedWidget
File "cached_image_widget.dart", line 194, in CachedNetworkImageState.build
File "framework.dart", line 3825, in StatefulElement.build
I guess that the downloading of the picture fails and then throws this exception. See:
https://github.com/renefloor/flutter_cache_manager/blob/7e7e47a2331fd41894c89c135751df4bfbb2a09b/lib/src/cache_manager.dart#L114-L120
Conflicto con dart 2.1.0 utilizando uuid:^0.5.3
In the getFile
function you are throwing the exception. Since you are em emitting a stream you can emit an error instead of throwing.
if (cacheFile == null) {
yield* Stream.fromFuture(Future.error(e));
}
I'd like to be able to empty entire cache on certain events (user logout, for example), but currently there seem to be no public API to achieve this.
I think you can consider to use Sqlite replaces SP. Because of the type of the data that persists is JSON.
Report useful errors back to users of the library.
Please you need to update and upgrade http in pubspec.yaml, from 0.11.3+4 to 0.12.0.Running "flutter
packages upgrade" in app.....
Because every version of flutter_test from sdk depends on http 0.12.0 and flutter_cache_manager >=0.1.0-rc.1 depends on http ^0.11.3+14, flutter_test from sdk is incompatible with flutter_cache_manager >=0.1.0-rc.1.
And because cached_network_image >=0.4.2 depends on flutter_cache_manager ^0.1.2, flutter_test from sdk is incompatible with cached_network_image >=0.4.2.
So, because app depends on both cached_network_image ^0.4.2 and flutter_test any from sdk, version solving failed.
I'm playing with the flutter_cached_network_image , trying to figure out how and where images are cached.
With the help of CacheManager.getFile
, I noticed that the path of cache images
/data/user/0/com.example.helloworld/cachecache/4fd9d460-4800-11e8-e6b9-3f018955612d.jpeg
is different with the getTemporaryDirectory
by path_provider
which is something like this
/data/user/0/com.example.helloworld/cache/hello_worldLNOPCM/hello_world/build/flutter_assets/AssetManifest.json
So, is this a bug?
It would be very nice when you add a function to manually update the file. So if a user pulls to refresh you can update the file.
var fileExtension = "";
if (response.hasHeader("content-type")) {
var type = response.header("content-type").split("/");
if (type.length == 2) {
fileExtension = ".${type[1]}";
}
}
You get file extensions by content-type,for example. Doc's content-type is application/msword,so the stored file name is uuid.msword,I want the filename is uuid.doc,So I can't open it in my app.
Why do not use content-disposition to get filenames for locally stored filenames,or we can specify the file name of the local store?
var fileExtension = "";
if (response.hasHeader("content-disposition")) {
var fileName = response
.header("content-disposition")
.split(";")[1]
.split("=")[1]
.replaceAll("\"", "");
fileExtension = fileName.substring(fileName.lastIndexOf("."));
} else if (response.hasHeader("content-type")) {
var type = response.header("content-type").split("/");
if (type.length == 2) {
fileExtension = ".${type[1]}";
}
}
Noticed this in the comments. So it takes legal action to actually get things from the cache?!
The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.
Because flutter_cache_manager >=0.1.0-rc.1 depends on uuid ^0.5.3 and flutter_cache_manager <0.1.0-rc.1 requires SDK version >=1.8.0 <2.0.0, every version of flutter_cache_manager requires uuid ^0.5.3.
Because uuid 0.5.3 requires SDK version >=1.0.0 <2.0.0 and no versions of uuid match >0.5.3 <0.6.0, uuid ^0.5.3 is forbidden.
Hi,
I'm looking to a way of caching files stored on Firebase cloud storage. Today, the API doesn't seems to allow to tweak the way files are downloaded.
I would like to intercept download request and use my own logic instead of using http download.
We could create an abstraction that would allow to customize the download process :
abstract class DownloadRequest {
Future<Uint8List> download();
}
class HttpDownloadRequest extends DownloadRequest {
final String url;
final Map<String, String> headers;
HttpDownloadRequest({@required this.url, this.headers});
Future<Uint8List> download() async {
// current logic in Future<CacheObject> _downloadFile(
}
}
class FirebaseStorageDownloadRequest extends DownloadRequest {
final StorageReference reference;
FirebaseStorageDownloadRequest({@required this.reference});
Future<Uint8List> download() async {
// use storage api
}
}
With this we could use a DownloadRequest
instead of a simple url when getting a file.
Future<File> getFile(String url, {Map<String, String> headers}) async {
final downloadRequest = HttpDownloadRequest(url: url, headers: headers);
return requestFile(downloadRequest);
}
Future<File> requestFile(DownloadRequest request) async {
// ...
}
need function, must return file, if file exist in cache otherwise null. another function name isExistFileInCache. In my case: me need check existing file in cache without loading from internet.
In flutter_cache_manager.dart on line 64, I have a key where the corresponding data value is null. This causes a crash. The cause is a link to an image that has been removed and returns 404.
_cacheData[key] = new CacheObject.fromMap(key, data)
In my case the error is caught further up:
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
'package:flutter/src/painting/image_stream.dart': Failed assertion: line 362 pos 12: '_codec != null': is not true.
#0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:37:39)
#1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:33:5)
#2 MultiFrameImageStreamCompleter._handleCodecReady (package:flutter/src/painting/image_stream.dart)
#3 _RootZone.runUnary (dart:async/zone.dart:1381:54)
#4 _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
#5 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:637:45)
#6 Future._propagateToListeners (dart:async/future_impl.dart:666:32)
#7 Future._completeError (dart:async/future_impl.dart:489:5)
#8 _SyncCompleter._completeError (dart:async/future_impl.dart:55:12)
#9 _Completer.completeError (dart:async/future_impl.dart:27:5)
#10 CachedNetworkImageProvider._loadAsync (package:cached_network_im<…>
Hi Rene,
Information about the files is stored in the shared preferences with the key "lib_cached_image_data". (Because images was the first use of this library :)) The date when the cache is last cleaned is stored as "lib_cached_image_data_last_clean".
You can actually pass this preferences in a Cache constructor (or in a getInstance()
method) and your network image library will pass these keys (ib_cached_image_data).
Second point - it will probably be good to be able to have multiple cache managers. For example I will need to cache both document and data - and not sure if I will have same clean/keep configurations for both...
My current project features the download of somewhat large files (20~30mb) which require the display of such elements.
It would be great if I can retrieve the download progress in a Stream to drive progress bars or other user interface elements.
The Basic authentication scheme can be handled with HTTP headers, so no problem here. However with Digest (and possibly other) auth schemes, the server responds with status 401 "unauthorized" and sends back 'www-authenticate' header with the data necessary to generate correct 'Authorization' header and re-post. Currently handling this within CacheManager class seems impossible. If someone knows how this could be handled, please correct me and explain how.
2019-04-16 15:29:25.240 12156-12156/com.my.test E/SQLiteDatabase: Failed to open database '/data/user/0/com.my.test/databases/test_image_cache.db'.
android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5): , while compiling: PRAGMA journal_mode
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:890)
at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:635)
at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:321)
at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:295)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:216)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:194)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:493)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:200)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:192)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:864)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:849)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:750)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:767)
at com.tekartik.sqflite.SqflitePlugin$Database.open(SqflitePlugin.java:792)
at com.tekartik.sqflite.SqflitePlugin$Database.access$900(SqflitePlugin.java:783)
at com.tekartik.sqflite.SqflitePlugin.onOpenDatabaseCall(SqflitePlugin.java:667)
at com.tekartik.sqflite.SqflitePlugin.onMethodCall(SqflitePlugin.java:762)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(FlutterNativeView.java:188)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6553)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
I got some sentry report with Exception maybe about flutter_cache_manager.
ConcurrentModificationError: Concurrent modification during iteration: _LinkedHashMap len:204.
File "hooks.dart", line 109, in _drawFrame
File "hooks.dart", line 122, in _invoke
File "zone.dart", line 925, in _CustomZone.runGuarded
File "zone.dart", line 1023, in _CustomZone.run
File "zone.dart", line 1126, in _rootRun
File "binding.dart", line 842, in BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame
File "binding.dart", line 930, in BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame
File "binding.dart", line 990, in BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback
File "binding.dart", line 208, in BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback
File "binding.dart", line 622, in BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame
File "binding.dart", line 272, in BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding.drawFrame
File "object.dart", line 796, in PipelineOwner.flushPaint
File "object.dart", line 110, in PaintingContext.repaintCompositedChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "layout_builder.dart", line 222, in _RenderLayoutBuilder.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "shifted_box.dart", line 70, in RenderShiftedBox.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 128, in PaintingContext.paintChild
File "object.dart", line 147, in PaintingContext._compositeChild
File "object.dart", line 110, in PaintingContext.repaintCompositedChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "viewport.dart", line 330, in RenderViewportBase.paint
File "object.dart", line 322, in PaintingContext.pushClipRect
File "object.dart", line 305, in PaintingContext.pushLayer
File "viewport.dart", line 339, in RenderViewportBase._paintContents
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "sliver_padding.dart", line 300, in RenderSliverPadding.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "sliver_multi_box_adaptor.dart", line 557, in RenderSliverMultiBoxAdaptor.paint
File "object.dart", line 128, in PaintingContext.paintChild
File "object.dart", line 147, in PaintingContext._compositeChild
File "object.dart", line 110, in PaintingContext.repaintCompositedChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "shifted_box.dart", line 70, in RenderShiftedBox.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 1863, in RenderDecoratedBox.paint
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "shifted_box.dart", line 70, in RenderShiftedBox.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "flex.dart", line 931, in RenderFlex.paint
File "box.dart", line 2196, in RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultPaint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 125, in RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
File "object.dart", line 130, in PaintingContext.paintChild
File "object.dart", line 2018, in RenderObject._paintWithContext
File "proxy_box.dart", line 1844, in RenderDecoratedBox.paint
File "box_decoration.dart", line 415, in _BoxDecorationPainter.paint
File "box_decoration.dart", line 397, in _BoxDecorationPainter._paintBackgroundImage
File "decoration_image.dart", line 239, in DecorationImagePainter.paint
File "image_provider.dart", line 264, in ImageProvider.resolve
File "synchronous_future.dart", line 38, in SynchronousFuture.then
File "image_provider.dart", line 266, in ImageProvider.resolve.<fn>
File "image_cache.dart", line 82, in ImageCache.putIfAbsent
File "image_provider.dart", line 266, in ImageProvider.resolve.<fn>.<fn>
File "cached_network_image.dart", line 40, in CachedNetworkImageProvider.load
File "<asynchronous suspension>"
File "cached_network_image.dart", line 51, in CachedNetworkImageProvider._loadAsync
File "<asynchronous suspension>"
File "flutter_cache_manager.dart", line 227, in CacheManager.getFile
File "<asynchronous suspension>"
File "flutter_cache_manager.dart", line 77, in CacheManager._save
File "<asynchronous suspension>"
File "flutter_cache_manager.dart", line 136, in CacheManager._cleanCache
File "synchronized.dart", line 33, in synchronized
File "synchronized_impl.dart", line 225, in synchronized
File "synchronized_impl.dart", line 157, in SynchronizedLock.synchronized
File "synchronized_impl.dart", line 147, in SynchronizedLock.synchronized.run
File "synchronized_impl.dart", line 83, in SynchronizedLock._run
File "future.dart", line 222, in new Future.sync
File "synchronized_impl.dart", line 84, in SynchronizedLock._run.<fn>
File "zone.dart", line 1501, in runZoned
File "zone.dart", line 1023, in _CustomZone.run
File "zone.dart", line 1126, in _rootRun
File "synchronized_impl.dart", line 86, in SynchronizedLock._run.<fn>.<fn>
File "<asynchronous suspension>"
File "flutter_cache_manager.dart", line 137, in CacheManager._cleanCache.<fn>
File "<asynchronous suspension>"
File "flutter_cache_manager.dart", line 153, in CacheManager._removeOldObjectsFromCache
File "iterable.dart", line 438, in WhereIterator.moveNext
File "compact_hash.dart", line 436, in _CompactIterator.moveNext
flutter: ══╡ EXCEPTION CAUGHT BY SERVICES ╞══════════════════════════════════════════════════════════════════
flutter: The following UnsupportedError was thrown resolving an image codec:
flutter: Unsupported operation: Cannot set value in unmodifiable Map
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 _ImmutableMap.[]= (dart:core/runtime/libimmutable_map.dart:78:5)
flutter: #1 CacheManager._downloadFile (package:flutter_cache_manager/flutter_cache_manager.dart:268:14)
flutter: <asynchronous suspension>
flutter: #2 CacheManager.getFile.<anonymous closure> (package:flutter_cache_manager/flutter_cache_manager.dart:236:34)
flutter: <asynchronous suspension>
flutter: #3 SynchronizedLock._runTask.<anonymous closure>.<anonymous closure> (package:synchronized/src/synchronized_impl.dart:189:29)
flutter: #7 SynchronizedLock._runTask.<anonymous closure> (package:synchronized/src/synchronized_impl.dart:187:14)
flutter: #9 SynchronizedLock._runTask (package:synchronized/src/synchronized_impl.dart:186:16)
flutter: #10 LockBase._createAndRunTask.run (package:synchronized/src/synchronized_impl.dart:61:14)
flutter: #11 LockBase._createAndRunTask (package:synchronized/src/synchronized_impl.dart:71:17)
flutter: #12 SynchronizedLock.synchronized (package:synchronized/src/synchronized_impl.dart:222:12)
flutter: #13 synchronized (package:synchronized/src/synchronized_impl.dart:284:19)
flutter: #14 synchronized (package:synchronized/synchronized.dart:47:15)
flutter: #15 CacheManager.getFile (package:flutter_cache_manager/flutter_cache_manager.dart:199:11)
flutter: <asynchronous suspension>
flutter: #16 CachedNetworkImageProvider._loadAsync (package:cached_network_image/cached_network_image.dart:472:35)
flutter: <asynchronous suspension>
flutter: #17 CachedNetworkImageProvider.load (package:cached_network_image/cached_network_image.dart:462:16)
flutter: #18 ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:265:86)
flutter: #19 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:82:22)
flutter: #20 ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:265:63)
flutter: #21 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:38:29)
flutter: #22 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:263:30)
flutter: #23 DecorationImagePainter.paint (package:flutter/src/painting/decoration_image.dart:239:55)
flutter: #24 _BoxDecorationPainter._paintBackgroundImage (package:flutter/src/painting/box_decoration.dart:397:19)
flutter: #25 _BoxDecorationPainter.paint (package:flutter/src/painting/box_decoration.dart:415:5)
Improve testability and add unit tests.
The uuid package have been updated, latest version has breaking API changes. Any plans to upgrade?
I/flutter (27693): The following NoSuchMethodError was thrown resolving an image codec:
I/flutter (27693): The method 'containsKey' was called on null.
I/flutter (27693): Receiver: null
I/flutter (27693): Tried calling:
I/flutter (27693): containsKey("https://www.theimageurl.com/theimage.jpg")
I/flutter (27693):
I/flutter (27693): When the exception was thrown, this was the stack:
I/flutter (27693): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
I/flutter (27693): #1 CacheManager.getFile (package:flutter_cache_manager/flutter_cache_manager.dart:190:21)
I/flutter (27693):
I/flutter (27693): #2 CachedNetworkImageProvider._loadAsync (package:cached_network_image/cached_network_image.dart:472:35)
I/flutter (27693):
I/flutter (27693): #3 CachedNetworkImageProvider.load (package:cached_network_image/cached_network_image.dart:462:16)
I/flutter (27693): #4 ImageProvider.resolve.. (package:flutter/src/painting/image_provider.dart:266:86)
I/flutter (27693): #5 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:143:20)
I/flutter (27693): #6 ImageProvider.resolve. (package:flutter/src/painting/image_provider.dart:266:63)
I/flutter (27693): #7 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:38:29)
I/flutter (27693): #8 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:264:30)
I/flutter (27693): #9 _ImageProviderResolver.resolve (package:cached_network_image/cached_network_image.dart:193:29)
I/flutter (27693): #10 _CachedNetworkImageState._resolveImage (package:cached_network_image/cached_network_image.dart:284:20)
I/flutter (27693): #11 _CachedNetworkImageState.didChangeDependencies (package:cached_network_image/cached_network_image.dart:261:5)
I/flutter (27693): #12 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3780:12)
I/flutter (27693): #13 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3630:5)
...
Many images load fine, but on occasion, some fail. The error is thrown from CacheManager on the third line of this function.
Future<File> getFile(String url, {Map<String, String> headers}) async {
String log = "[Flutter Cache Manager] Loading $url";
if (!_cacheData.containsKey(url)) {
await synchronized(_lock, () {
if (!_cacheData.containsKey(url)) {
_cacheData[url] = new CacheObject(url);
}
});
}
...
Example: I was trying to download CachedNetworkImage, that required authentication. Forgot to give correct authentication headers (or gave a wrong one). Now cache manager saves as my image an http response - a web page asking to log-in. Code crashes trying to create a JPEG image from that HTML code... There is no official way to remove that bad "image" from the cache until it expires.
Hi
I'm using cache manager for images but for some api calls as well, I load some json that change once a week.
The thing is, there is no way to evict a url from cache manually when I know the data has changed.
If we could have several cache managers, like mentioned in #5 that would do, because I can setup a distinct eviction strategy for these files.
Hey! First of all thanks for the library! However:
[07-27 11:19:15.606 14119-14141/io.fnx.draw I/flutter: ══╡ EXCEPTION CAUGHT BY SERVICES ╞══════════════════════════════════════════════════════════════════
07-27 11:19:15.611 14119-14141/io.fnx.draw I/flutter: The following UnsupportedError was thrown resolving an image codec:
07-27 11:19:15.611 14119-14141/io.fnx.draw I/flutter: Unsupported operation: Cannot set value in unmodifiable Map
07-27 11:19:15.613 14119-14141/io.fnx.draw I/flutter: When the exception was thrown, this was the stack:
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #0 _ImmutableMap.[]= (dart:core/runtime/libimmutable_map.dart:72:5)
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #1 CacheManager._downloadFile (package:flutter_cache_manager/flutter_cache_manager.dart:268:14)
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: <asynchronous suspension>
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #2 CacheManager.getFile.<anonymous closure> (package:flutter_cache_manager/flutter_cache_manager.dart:236:34)
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: <asynchronous suspension>
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #3 ReentrantLock._runTask.<anonymous closure>.<anonymous closure> (package:synchronized/src/synchronized_impl.dart:197:29)
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #8 ReentrantLock._runTask.<anonymous closure> (package:synchronized/src/synchronized_impl.dart:195:14)
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #10 ReentrantLock._runTask (package:synchronized/src/synchronized_impl.dart:194:16)
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #11 LockBase._createAndRunTask.run (package:synchronized/src/synchronized_impl.dart:62:14)
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #12 LockBase._createAndRunTask (package:synchronized/src/synchronized_impl.dart:72:17)
07-27 11:19:15.622 14119-14141/io.fnx.draw I/flutter: #13 ReentrantLock.synchronized (package:synchronized/src/synchronized_impl.dart:230:12)
07-27 11:19:15.623 14119-14141/io.fnx.draw I/flutter: #14 synchronized (package:synchronized/src/synchronized_impl.dart:295:19)
07-27 11:19:15.623 14119-14141/io.fnx.draw I/flutter: #15 synchronized (package:synchronized/src/synchronized_compat.dart:35:10)
07-27 11:19:15.623 14119-14141/io.fnx.draw I/flutter: #16 CacheManager.getFile (package:flutter_cache_manager/flutter_cache_manager.dart:199:11)
07-27 11:19:15.623 14119-14141/io.fnx.draw I/flutter: <asynchronous suspension>
07-27 11:19:15.623 14119-14141/io.fnx.draw I/flutter: #17 CachedNetworkImageProvider._loadAsync (package:cached_network_image/cached_network_image.dart:472:35)
07-27 11:19:15.623 14119-14141/io.fnx.draw I/flutter: <asynchronous suspension>
07-27 11:19:15.623 14119-14141/io.fnx.draw I/flutter: #18 CachedNetworkImageProvider.load (package:cached_network_image/cached_network_image.dart:462:16)
07-27 11:19:15.623 14119-14141/io.fnx.draw I/flutter: #19 ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:266:86)]
When I start my app freshly, everything works. It's working for about 24 hours, and then all images disappear and the message above appears in the log. My guess is that cache information is still present in the SharedPreferences, but files are for some reason gone.
Hi
In cache_manager.dart > BaseCacheManager#getSingleFile
you might be missing a dart "await" when downloading after a non-valid cache hit.
I request images from a server that generates them and responds with a 201 if the image was created. I changed my local copy, but could you add support for 201 as well?
https://github.com/renefloor/flutter_cache_manager/blob/master/lib/src/web_helper.dart#L90
The package version shows an error while executing flutter packages get. It says no versions found.
i got the dio.response,how can i convert it to http.response,.
i want to use like this:
static Future<FileFetcherResponse> _customHttpGetter(String url,
{Map<String, String> headers}) async {
Dio.Response response = await commonHttp.get(url);
http.Response res = http.Response(json.encode(response.data), response.statusCode);
return HttpFileFetcherResponse(res);
}
bug i got an err,
Uint8List convert(String string, [int start = 0, int end]) {
var stringLength = string.length;
end = RangeError.checkValidRange(start, end, stringLength);
var length = end - start;
var result = Uint8List(length);
for (var i = 0; i < length; i++) {
var codeUnit = string.codeUnitAt(start + i);
if ((codeUnit & ~_subsetMask) != 0) {
throw ArgumentError.value( // here is the err
string, "string", "Contains invalid characters.");
}
result[i] = codeUnit;
}
return result;
}
maybe you know how to do this. could you give some suggestions
actually, my app use a self-singed certificate , there area any config in CustomCacheManager ?
Hi Rene,
I am about to start using Cache Manager to cache documents.
Imagine a scenario where user selects a local document which is then uploaded to the Cloud.
All other users will use cache manager to download that document and see.
However the user who just uploaded document - should not need to download it again.
For example - chat app. I pick a local PDF document and send a message.
The document is uploaded. At this stage I want to give Cache manager document with certain path - so it won't download it .
Otherwise there is a massive delay - (as document needs to be downloaded) or very complicated logic on a client (we need to track whether the document was local and store local copy (as on iOS documents are accesible only for short period of time after picking))
In WebHelper, maybe _memCache have problem ?
From cached_network_image: ^0.4.0
cached_network_image
E/flutter (14365): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (14365): NoSuchMethodError: No static method 'from' declared in class 'List'.
E/flutter (14365): Receiver: List
E/flutter (14365): Tried calling: from(Instance of 'WhereIterable')
E/flutter (14365): #0 NoSuchMethodError._throwNew (dart:core-patch/dart:core/errors_patch.dart:192)
E/flutter (14365): #1 CacheManager._removeOldObjectsFromCache (package:flutter_cache_manager/flutter_cache_manager.dart:149:26)
E/flutter (14365): <asynchronous suspension>
E/flutter (14365): #2 CacheManager._cleanCache.<anonymous closure> (package:flutter_cache_manager/flutter_cache_manager.dart:135:15)
E/flutter (14365): <asynchronous suspension>
E/flutter (14365): #3 SynchronizedLock._runTask.<anonymous closure>.<anonymous closure> (package:synchronized/src/synchronized_impl.dart:189:29)
E/flutter (14365): #4 _rootRun (dart:async/zone.dart:1126)
E/flutter (14365): #5 _CustomZone.run (dart:async/zone.dart:1023)
E/flutter (14365): #6 runZoned (dart:async/zone.dart:1501)
E/flutter (14365): #7 SynchronizedLock._runTask.<anonymous closure> (package:synchronized/src/synchronized_impl.dart:187:14)
E/flutter (14365): #8 new Future.sync (dart:async/future.dart:222)
E/flutter (14365): #9 SynchronizedLock._runTask (package:synchronized/src/synchronized_impl.dart:186:16)
E/flutter (14365): #10 LockBase._createAndRunTask.run (package:synchronized/src/synchronized_impl.dart:61:14)
E/flutter (14365): #11 LockBase._createAndRunTask (package:synchronized/src/synchronized_impl.dart:71:17)
E/flutter (14365): #12 SynchronizedLock.synchronized (package:synchronized/src/synchronized_impl.dart:222:12)
E/flutter (14365): #13 synchronized (package:synchronized/src/synchronized_impl.dart:284:19)
E/flutter (14365): #14 synchronized (package:synchronized/synchronized.dart:47:10)
E/flutter (14365): #15 CacheManager._cleanCache (package:flutter_cache_manager/flutter_cache_manager.dart:134:13)
E/flutter (14365): <asynchronous suspension>
E/flutter (14365): #16 CacheManager._save (package:flutter_cache_manager/flutter_cache_manager.dart:75:11)
E/flutter (14365): <asynchronous suspension>
E/flutter (14365): #17 CacheManager.getFile (package:flutter_cache_manager/flutter_cache_manager.dart:243:5)
E/flutter (14365): <asynchronous suspension>
E/flutter (14365): #18 CachedNetworkImageProvider._loadAsync (package:cached_network_image/cached_network_image.dart:474:35)
E/flutter (14365): <asynchronous suspension>
E/flutter (14365): #19 CachedNetworkImageProvider.load (package:cached_network_image/cached_network_image.dart:462:16)
E/flutter (14365): #20 ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:265:86)
E/flutter (14365): #21 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:82:22)
E/flutter (14365): #22 ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:265:63)
E/flutter (14365): #23 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:38:29)
E/flutter (14365): #24 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:263:30)
E/flutter (14365): #25 DecorationImagePainter.paint (package:flutter/src/painting/decoration_image.dart:239:55)
E/flutter (14365): #26 _BoxDecorationPainter._paintBackgroundImage (package:flutter/src/painting/box_decoration.dart:397:19)
E/flutter (14365): #27 _BoxDecorationPainter.paint (package:flutter/src/painting/box_decoration.dart:415:5)
E/flutter (14365): #28 RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:1850:16)
E/flutter (14365): #29 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (14365): #30 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:130:13)
E/flutter (14365): #31 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:125:15)
E/flutter (14365): #32 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (14365): #33 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:130:13)
E/flutter (14365): #34 RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:70:15)
E/flutter (14365): #35 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (14365): #36 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:130:13)
E/flutter (14365): #37 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:125:15)
E/flutter (14365): #38 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (14365): #39 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:13
Right now the cache manager uses the temp directory which means the OS can delete it any time.
Some apps can't live with this and the solution is simple to add a way in the CacheManager to configure the cache directory.
I can make a PR to solve this issue, will it be relevant?
This is happening with many developers using the caching library. We hope its a quick update (with little to no breakage) on your end. The new versions of uuid have this PI variable taken off.
The error:
compiler message: file:///Users/user/.pub-cache/hosted/pub.dartlang.org/uuid-0.5.3/lib/uuid.dart:20:24: Error: Getter not found: 'PI'.
compiler message: static final TAU = 2*PI;
compiler message:
Thanks for the plugin. I'm using it currently (through the cached_network_image plugin but I think my issue is more related to this package) to display a list of about 5000 lines where each line has a thumbnail url.
As you might expect it generates a log of fetches and sqflite writes and it seems to sometimes lead to some 'stuttering'.
Sometimes I would like this cache manager to be less efficient (i.e less download). Maybe there could be a pool and the base cache manager could allow for a poolResourceCount so for example no more that 4 images are fetched in parallel.
Additionnaly. Sometimes I know I'm going to display a page of 50 images. Currently it leads to 50 writes where a sqlite batch would be more efficient (I know sqflite is fast compare to fetching images). I have not looked much at the API but is there a way to cache multiple files in one call (something like downloadFiles) that could in future improve its implementation to limit the number of concurrent fetches and group sqflite writes).
As a side note, when an image is missing (404), it generates a lot of warning in the output, I just wonder if we could 'hide' subsequent warning', i.e. display it only once.
Thanks!
I am using 0.3.0-alpha.2 & cached_network_image 0.6.0-alpha.2.
I consistently get DatabaseException(database_closed) exception off and on during development. Once I get this exception, all the images will subsequently fail to load.
E/flutter (20733): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (20733): DatabaseException(database_closed 17)
E/flutter (20733): #0 wrapDatabaseException (package:sqflite/src/exception.dart:125:7)
E/flutter (20733): <asynchronous suspension>
E/flutter (20733): #1 SqfliteDatabase.txnRawQuery.<anonymous closure> (package:sqflite/src/database.dart:330:14)
E/flutter (20733): #2 SqfliteDatabase.txnSynchronized.<anonymous closure> (package:sqflite/src/database.dart:279:22)
E/flutter (20733): #3 Lock._runTask (package:synchronized/src/synchronized_impl.dart:149:27)
E/flutter (20733): #4 LockBase._createAndRunTask.run (package:synchronized/src/synchronized_impl.dart:64:14)
E/flutter (20733): #5 LockBase._createAndRunTask (package:synchronized/src/synchronized_impl.dart:74:17)
E/flutter (20733): #6 Lock.synchronized (package:synchronized/src/synchronized_impl.dart:142:12)
E/flutter (20733): #7 SqfliteDatabase.txnSynchronized (package:sqflite/src/database.dart:275:37)
E/flutter (20733): <asynchronous suspension>
E/flutter (20733): #8 SqfliteDatabase.txnRawQuery (package:sqflite/src/database.dart:329:12)
E/flutter (20733): #9 SqfliteDatabaseExecutor.rawQuery (package:sqflite/src/database.dart:92:10)
E/flutter (20733): #10 SqfliteDatabaseExecutor.query (package:sqflite/src/database.dart:86:12)
E/flutter (20733): #11 CacheObjectProvider.get (package:flutter_cache_manager/src/cache_object.dart:100:31)
E/flutter (20733): <asynchronous suspension>
E/flutter (20733): #12 CacheStore._getCacheDataFromDatabase (package:flutter_cache_manager/src/cache_store.dart:84:31)
E/flutter (20733): <asynchronous suspension>
E/flutter (20733): #13 CacheStore.retrieveCacheData (package:flutter_cache_manager/src/cache_store.dart:63:7)
E/flutter (20733): #14 CacheStore.getFile (package:flutter_cache_manager/src/cache_store.dart:46:29)
E/flutter (20733): <asynchronous suspension>
E/flutter (20733): #15 BaseCacheManager.getFileFromCache (package:flutter_cache_manager/src/cache_manager.dart:128:24)
E/flutter (20733): <asynchronous suspension>
E/flutter (20733): #16 BaseCacheManager.getSingleFile (package:flutter_cache_manager/src/cache_manager.dart:89:27)
E/flutter (20733): <asynchronous suspension>
E/flutter (20733): #17 CachedNetworkImageProvider._loadAsync (package:cached_network_image/cached_network_image.dart:482:27)
E/flutter (20733): <asynchronous suspension>
E/flutter (20733): #18 CachedNetworkImageProvider.load (package:cached_network_image/cached_network_image.dart:472:16)
E/flutter (20733): #19 ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:267:86)
E/flutter (20733): #20 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:143:20)
E/flutter (20733): #21 ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:267:63)
E/flutter (20733): #22 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:38:29)
E/flutter (20733): #23 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:265:30)
E/flutter (20733): #24 _ImageProviderResolver.resolve (package:cached_network_image/cached_network_image.dart:197:29)
E/flutter (20733): #25 _CachedNetworkImageState._resolveImage (package:cached_network_image/cached_network_image.dart:292:20)
E/flutter (20733): #26 _CachedNetworkImageState.didChangeDependencies (package:cached_network_image/cached_network_image.dart:267:5)
E/flutter (20733): #27 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3846:12)
E/flutter (20733): #28 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
E/flutter (20733): #29 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
E/flutter (20733): #30 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
E/flutter (20733): #31 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
E/flutter (20733): #32 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
E/flutter (20733): #33 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
E/flutter (20733): #34 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
E/flutter (20733): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
E/flutter (20733): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
E/flutter (20733): #37 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
E/flutter (20733): #38 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
E/flutter (20733): #39 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
E/flutter (20733): #40 SingleChildRenderObjectElement.mount (package
Just a suggestion - I would like to have a possibility to specify more "cache regions" and configure different limits, cache duration etc. Some of the files should be cached for a long time, some just for an hour ...
private final android.content.SharedPreferences preferences;
public static void registerWith(PluginRegistry.Registrar registrar) {
MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME);
SharedPreferencesPlugin instance = new SharedPreferencesPlugin(registrar.context());
channel.setMethodCallHandler(instance);
}
private SharedPreferencesPlugin(Context context) {
preferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
}
preferences 占用着内存无法释放
当很多时是不是会大量占用内存
Preferences occupy memory and cannot be freed
Does it take up a lot of memory when it's too much?
The latest uuid package version is 1.0.0. Because of which the dependency resolution fails.
Running "flutter packages get" in hsg...
Because flutter_cache_manager 0.1.1 depends on uuid ^0.5.3 and hsg depends on uuid 1.0.0, flutter_cache_manager 0.1.1 is forbidden.
So, because hsg depends on flutter_cache_manager 0.1.1, version solving failed.
pub get failed (1)
I have a server which sends back a ETag
header of certain assets as follows:
Accept-Ranges: bytes
Content-Length: 166083
Content-Type: image/jpeg
Date: Mon, 02 Jul 2018 13:35:01 GMT
ETag: "99cb5754f1227febf3269ad826d3b5e9"
Last-Modified: Mon, 02 Jul 2018 12:57:31 GMT
Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
x-amz-request-id: tx00000000000000056abfb-005b3a2a05-16f571-sgp1a
However, after updating the image, it still displays the old image.
The Export is necessary for the FileFetcher.
Since Dart doesn't have any shared memory, why do you thing there is a reason to synchronise adding to Map?
I have an app which uses flutter_image/NetworkImageWithRetry and I'm trying to preload a set of images, which are then used later.
I was hoping that a cache could somehow be shared between flutter_cache_manager and flutter_image, but can't see any way to do this ?
Assuming that's not possible, is there a way to check if a file exists in the cache (and getting it's file location), so I could add some logic, if file exists, load it locally from flutter_image_cache, if not use networkimagewithretry ?
Hope that kind of makes sense!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.