Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashed when I run the demo," _cacheData.containsKey(url) ",_cacheData is null #52

Closed
hasonguo opened this issue Jul 6, 2018 · 1 comment

Comments

@hasonguo
Copy link

hasonguo commented Jul 6, 2018

The following NoSuchMethodError was thrown resolving an image codec:
flutter: The method 'containsKey' was called on null.
flutter: Receiver: null
flutter: Tried calling: containsKey("http://via.placeholder.com/350x200")
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
flutter: #1 CacheManager.getFile (package:example/flutter_cache_manager.dart:202:21)
flutter:
flutter: #2 CachedNetworkImageProvider._loadAsync (package:example/cached_network_image.dart:474:35)
flutter:

code below:

Future getFile(String url, {Map<String, String> headers}) async {
String log = "[Flutter Cache Manager] Loading $url";

if (!_cacheData.containsKey(url)) {
  await _lock.synchronized(() {
    if (!_cacheData.containsKey(url)) {
      _cacheData[url] = new CacheObject(url);
    }
  });
}
@renefloor
Copy link
Contributor

This is fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants