Detect config drift in cached tile providers and replace stale instances

When a user edits a tile type's URL template, max zoom, or API key
without changing IDs, the cached DeflockTileProvider would keep the old
frozen config. Now _getOrCreateProvider() computes a config fingerprint
and replaces the provider when drift is detected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Doug Borg
2026-03-04 10:12:49 -07:00
parent f3f40f36ef
commit 91e5177056
7 changed files with 197 additions and 13 deletions
@@ -37,8 +37,11 @@ class ProviderTileCacheManager {
required ServicePolicy policy,
int? maxCacheBytes,
}) {
assert(_baseCacheDir != null,
'ProviderTileCacheManager.init() must be called before getOrCreate()');
if (_baseCacheDir == null) {
throw StateError(
'ProviderTileCacheManager.init() must be called before getOrCreate()',
);
}
final key = '$providerId/$tileTypeId';
if (_stores.containsKey(key)) return _stores[key]!;