Closed tratteo closed 1 year ago
Hi @tratteo,
In regards to the second issue, there is nothing I can do to prevent it. There are no image bytes to return from the ImageProvider
- so the only possible exit is through throwing an exception. Every ImageProvider
will do this in the event that it can't retrieve an image.
Sometimes Flutter decides to report this silently, and sometimes it doesn't: but I always throw this in the same circumstances every time. You can check the code here: https://github.com/JaffaKetchup/flutter_map_tile_caching/blob/3d723ed052f0e27de50e2f3db351ad95e43c5516/lib/src/providers/image_provider.dart#L157-L173
In regards to the first issue, that code isn't part of my library, and looks to be part of Flutter's ImageCache
. It actually looks as though this could be a bug in Flutter - it might be worthwhile opening an issue there and linking here.
Whilst they are likely related, Flutter shouldn't be throwing this kind of error. It likely occurs because Flutter thinks there is a cached image at that key, but in reality, there isn't.
Can you try the following solution when you get a moment? Fork this project and depend on it with an override, then replace the following lines:
with these:
final error = FMTCBrowsingError(throwError, throwErrorType!);
await evict();
// ImageCache().evict(key); // Uncomment this one if the issue isn't solved without it
provider.settings.errorHandler?.call(error);
throw error;
flutter_map v4 may support disabling of loading and pruning of new tiles on demand, for example during animations. See the bottom of https://github.com/fleaflet/flutter_map/pull/1475#issue-1645808772 for more info.
What is the bug?
Animating the movement in the map on large areas
Using a cached tileProvider with behaviour
cacheFirst
and moving on the map (I am doing around 100 Km in 1 second) causes tons of this errors to be thrown:In this case I am offline and I try to move out of the cached zone
In this case I am offline and I am using the cached tile provider. Instead of being catched and logged, the error is thrown, causing tons of more exceptions per tile. I think this is related to the issue above.
What is the expected behaviour?
Silently fail or at least prevent exceptions to be actually thrown. The error indeed does not happen when not using the cached tile provider.
How can we reproduce this issue?
Do you have a potential solution?
The second error is thrown because of the first one, this is my guess. Indeed in case the first error is not thrown, the
FMTCBrowingError
is thrown silently (correctly)Can you provide any other information?
No response
Platforms Affected
Android
Severity
Minimum: Allows normal functioning
Frequency
Often: Occurs more often than when it doesn't
Requirements