I am using flutter_map_tile_cache lib to cache tile but I am not able to cache WMSTileLayerOptions layers please provide any solution
TileLayer(
wmsOptions: WMSTileLayerOptions(
baseUrl: 'https://apps.xyz.com:8080/myserver/wms/?',
layers: ['XYZLAYER:stateboundary],
format: 'image/png',
transparent: true,
),
backgroundColor: Colors.transparent,
userAgentPackageName: 'com.example.xyz',
tileProvider: FMTC.instance('mapStore').getTileProvider(),
),
getting error like this:- FMTCBrowsingError: Failed to load the tile from the cache or the network because it was missing from the cache and a connection to the server could not be established.
The flutter libraries "flutter_map" and "cached_network_image" can fulfill our requirements.
We need to implement like this:
class CachedNetworkTileProvider extends TileProvider {
@override
ImageProvider getImage(TileCoordinates coordinates, TileLayer options)
{
return CachedNetworkImageProvider(getTileUrl(coordinates, options));
}
}
And
TileLayer(wmsOptions: WMSTileLayerOptions(
baseUrl: 'https://apps.example.com:8080/myserver/wms/?',
layers: ['XYZLAYER:stateboundary'],
format: 'image/png',
transparent: true,
),
backgroundColor: Colors.transparent,
userAgentPackageName: 'com.example.xyz',
tileProvider: CachedNetworkTileProvider(),
),