Skip to content

Commit

Permalink
bug fixes, version 22.
Browse files Browse the repository at this point in the history
  • Loading branch information
apps4av committed Jul 21, 2024
1 parent 407988f commit f9bc3ee
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/map_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ class MapScreen extends StatefulWidget {

class MapScreenState extends State<MapScreen> {

StreamController<void> mapReset = StreamController<void>(); // to reset the radar map
StreamController<void>? mapReset; // to reset the radar map
void resetRadar() {
mapReset.add(null);
if(mapReset != null) {
mapReset!.add(null);
}
for(int i = 0; i < Storage().mesonetCache.length; i++) {
Storage().mesonetCache[i].clean(); // clean mesonet cache
}
Expand Down Expand Up @@ -127,6 +129,11 @@ class MapScreenState extends State<MapScreen> {
@override
Widget build(BuildContext context) {

if(mapReset != null) {
mapReset!.close();
}
mapReset = StreamController();

TileLayer osmLayer = TileLayer(
urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
tileProvider: CachedTileProvider(
Expand Down Expand Up @@ -154,7 +161,7 @@ class MapScreenState extends State<MapScreen> {
];
return TileLayer(
maxNativeZoom: 5,
reset: mapReset.stream,
reset: mapReset!.stream,
urlTemplate: mesonets[index],
tileProvider: CachedTileProvider(
// maxStale keeps the tile cached for the given Duration and
Expand Down

0 comments on commit f9bc3ee

Please sign in to comment.