dispose method

  1. @override
Future<void> dispose()
override

Called when the TileLayer is disposed

When disposing resources, ensure that they are not currently being used by tiles in progress.

Implementation

@override
Future<void> dispose() async {
  if (_tilesInProgress.isNotEmpty) {
    await Future.wait(_tilesInProgress.values.map((c) => c.future));
  }
  _httpClient.close();
  super.dispose();
}