You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tiles will not load after usage without a network #576
When the connectivity was lost and is restored the tiles that failed to load when the connectivity was lost will continue to fail to load: SocketException: Failed host lookup: 'a.tile.openstreetmap.org' (OS Error: No address associated with hostname, errno = 7)
This seems serious bug however I tested this against 0.8.2 release and it behaves same way. git checkout 031fa41544f34a91acf69d0c3b758514f1ea2f5c or if you are using it as dependency flutter_map: 0.8.2 (not ^0.8.2) then flutter pub upgrade.
Here is a fast 0.8.2 preview:
I think I know how to fix this issue, give me some time and I will make a new PR, the main problem is within flutter because it caches the failed Image, see:
/// Fetches the given URL from the network, associating it with the given scale.
///
/// The image will be cached regardless of cache headers from the server.
///
/// When a network image is used on the Web platform, the [cacheWidth] and
/// [cacheHeight] parameters of the [DecoderCallback] are ignored as the Web
/// engine delegates image decoding of network images to the Web, which does
/// not support custom decode sizes.
///
/// See also:
///
/// * [Image.network] for a shorthand of an [Image] widget backed by [NetworkImage].
// TODO(ianh): Find some way to honor cache headers to the extent that when the
// last reference to an image is released, we proactively evict the image from
// our cache if the headers describe the image as having expired at that point.
abstract class NetworkImage extends ImageProvider<NetworkImage> {
@ristiisa take a test ride with #577 don't forget to provide evictErrorTiles flag to TileLayerOptions since error tiles will become active they will be retained too, however _pruneTiles will have chance to evict error tiles if they are not retained anymore.
Some time after the connectivity is restored an exception is caught: it was because they were not retained anymore and phone wanted to refetch the Image, forinstance this happens if an error happened on zoom lvl 5 and you changed zoom to lvl 7 or if overpanning the default 2 tiles margin.
@ristiisa take a test ride with #577 don't forget to provide evictErrorTiles flag to TileLayerOptions since error tiles will become active they will be retained too, however _pruneTiles will have chance to evict error tiles if they are not retained anymore.
I'm not sure if I'm seeing any changes in the behavior.
It's because _pruneTiles / _abortLoading wasn't called, I have seen your video and map was moved by a MapController which took small steps and error tiles was still retained. I think I can make evictErrorTiles even stricter forinstance if error Tile is not in viewport / not on same zoom lvl as mapState.zoom then evict an error tile may seem fair enough. So I think evictErrorTiles will be better evictErrorTilesStrategy enum which will support/allow this behaviour.
// If a Tile was loaded with error and if this flag is true, then TileProvider
// will be asked to evict Image during _pruneTiles / _abortLoading calls
// (see #576 - even Error Images are cached in flutter)
final bool evictErrorTiles;
Anyway if you are moving map by a controller then #579 contains some fix.
Activity
maRci002 commentedon Apr 7, 2020
This seems serious bug however I tested this against
0.8.2 releaseand it behaves same way.git checkout 031fa41544f34a91acf69d0c3b758514f1ea2f5cor if you are using it as dependencyflutter_map: 0.8.2(not ^0.8.2) thenflutter pub upgrade.Here is a fast 0.8.2 preview:

I think I know how to fix this issue, give me some time and I will make a new PR, the main problem is within flutter because it caches the failed Image, see:
maRci002 commentedon Apr 7, 2020
@ristiisa take a test ride with #577 don't forget to provide
evictErrorTilesflag toTileLayerOptionssince error tiles will become active they will be retained too, however _pruneTiles will have chance to evict error tiles if they are not retained anymore.maRci002 commentedon Apr 7, 2020
Some time after the connectivity is restored an exception is caught:it was because they were not retained anymore and phone wanted to refetch the Image, forinstance this happens if an error happened on zoom lvl 5 and you changed zoom to lvl 7 or if overpanning the default 2 tiles margin.ristiisa commentedon Apr 9, 2020
I'm not sure if I'm seeing any changes in the behavior.
maRci002 commentedon Apr 9, 2020
It's because
_pruneTiles/_abortLoadingwasn't called, I have seen your video and map was moved by a MapController which took small steps and error tiles was still retained. I think I can makeevictErrorTileseven stricter forinstance if error Tile is not in viewport / not on same zoom lvl as mapState.zoom then evict an error tile may seem fair enough. So I thinkevictErrorTileswill be betterevictErrorTilesStrategyenum which will support/allow this behaviour.Anyway if you are moving map by a controller then #579 contains some fix.
maRci002 commentedon Apr 10, 2020
@ristiisa I updated the PR with more strategy like
EvictErrorTileStrategy.notVisible.eis6aer commentedon Aug 22, 2020
Is there any workaround that you can think of for the moment? Until the real fix is implemented ?