File tree 3 files changed +17
-2
lines changed
features/map_view/widgets
3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,12 @@ abstract class OpenStreetMapConfig {
51
51
Platform .isIOS ? "com.solvro.ToPwr" : "com.solvro.topwr" ;
52
52
}
53
53
54
+ abstract class MapCacheConfig {
55
+ // in days
56
+ static const cacheDuration = 30 ;
57
+ static const cacheBoxName = "HiveMapCacheStore" ;
58
+ }
59
+
54
60
abstract class BuildingSearchConfig {
55
61
static const buildingCodeSeperator = "-" ;
56
62
}
Original file line number Diff line number Diff line change
1
+ import "package:dio_cache_interceptor_hive_store/dio_cache_interceptor_hive_store.dart" ;
1
2
import "package:flutter/material.dart" ;
2
3
import "package:flutter_map/flutter_map.dart" ;
3
- import "package:flutter_map_cancellable_tile_provider/flutter_map_cancellable_tile_provider .dart" ;
4
+ import "package:flutter_map_cache/flutter_map_cache .dart" ;
4
5
import "package:flutter_riverpod/flutter_riverpod.dart" ;
5
6
6
7
import "../../../config/map_view_config.dart" ;
@@ -38,7 +39,13 @@ class MapWidget<T extends GoogleNavigable> extends ConsumerWidget {
38
39
TileLayer (
39
40
urlTemplate: OpenStreetMapConfig .tileUrl,
40
41
userAgentPackageName: OpenStreetMapConfig .userAgent,
41
- tileProvider: CancellableNetworkTileProvider (),
42
+ tileProvider: CachedTileProvider (
43
+ maxStale: const Duration (days: MapCacheConfig .cacheDuration),
44
+ store: HiveCacheStore (
45
+ null ,
46
+ hiveBoxName: MapCacheConfig .cacheBoxName,
47
+ ),
48
+ ),
42
49
),
43
50
MarkersConsumerLayer <T >(),
44
51
const MyLocationLayer (),
Original file line number Diff line number Diff line change @@ -73,12 +73,14 @@ dependencies:
73
73
flutter_map_cancellable_tile_provider : ^3.0.2
74
74
flutter_map_location_marker : ^9.1.1
75
75
flutter_map_compass : ^1.0.3
76
+ flutter_map_cache : ^1.3.0
76
77
hooks_riverpod : ^2.5.2
77
78
firebase_crashlytics : ^4.1.2
78
79
firebase_analytics : ^11.3.2
79
80
firebase_core : ^3.5.0
80
81
firebase_performance : ^0.10.0+7
81
82
firebase_messaging : ^15.1.2
83
+ dio_cache_interceptor_hive_store : ^3.2.1
82
84
83
85
dev_dependencies :
84
86
flutter_test :
You can’t perform that action at this time.
0 commit comments