estimateTileRegion method
- String id,
- TileRegionLoadOptions loadOptions,
- TileRegionEstimateOptions? estimateOptions,
- OnTileRegionEstimateProgressListenter? progressListener,
Estimates the storage and transfer size of a tile region.
@param id The tile region identifier. @param loadOptions The tile region load options. @param estimateOptions The options for the estimate operation. Optional, default values will be applied if null. @param progressListener Invoked multiple times to report progress of the estimate operation.
This can be used for estimating existing or new tile regions. For new tile regions, both geometry and tileset descriptors need to be provided to the given load options. If a tile region with the given id already exists, its geometry and tileset descriptors are reused unless a different value is provided in the region load options.
Estimating a tile region does not mutate existing tile regions on the tile store.
Implementation
Future<TileRegionEstimateResult> estimateTileRegion(
String id,
TileRegionLoadOptions loadOptions,
TileRegionEstimateOptions? estimateOptions,
OnTileRegionEstimateProgressListenter? progressListener) async {
if (progressListener != null) {
await _api.addTileRegionEstimateProgressListener(id);
final eventChannel = EventChannel(
"com.mapbox.maps.flutter/${_messageChannel}/tile-region-estimate-${id}");
eventChannel.receiveBroadcastStream().listen((event) {
progressListener(TileRegionEstimateProgress.decode(event));
});
}
return _api.estimateTileRegion(id, loadOptions, estimateOptions);
}