josxha / flutter_map_plugins

The source code for all sorts of flutter_map plugins.
https://pub.dev/publishers/joscha-eckert.de/packages
28 stars 20 forks source link

[flutter_map_cache] CachedImageProvider generates assert errors #36

Closed Thelm76 closed 7 months ago

Thelm76 commented 7 months ago

each time I open my map, I have the following exception occurring multiple times :

flutter: core binding run 'package:flutter/src/painting/image_stream.dart': Failed assertion: line 268 pos 15: 'expectedTotalBytes == null || expectedTotalBytes >= 0': is not true.
flutter: 
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2      new ImageChunkEvent (package:flutter/src/painting/image_stream.dart:268:15)
#3      CachedImageProvider._loadAsync.<anonymous closure> (package:flutter_map_cache/src/cached_image_provider.dart:84:13)
#4      SyncTransformer.transformResponse.<anonymous closure> (package:dio/src/transformers/sync_transformer.dart:82:36)
#5      _rootRunUnary (dart:async/zone.dart:1407:47)
#6      _CustomZone.runUnary (dart:async/zone.dart:1308:19)
#7      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:7)
#8      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#9      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#10     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#11     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#12     IO<…>
josxha commented 7 months ago

Thanks for the bug report @Thelm76! Could you provide some additional information please? - how do you create your CachedTileProvider? - what CacheStore do you use? - what tile provider do you use?

edit: I've seen your PR. Thanks didn't knew that dio returns a -1 for total bytes.