hostNativeCacheBase function
Root the Native Assets hooks cache downloaded bundles under.
Mirrors _cacheBaseDir() in the hooks. Null when the platform's home
directory is not readable, in which case the cache is simply not a
candidate — callers still have their local paths.
Implementation
String? hostNativeCacheBase() {
final env = Platform.environment;
if (Platform.isWindows) {
final local = env['LOCALAPPDATA'];
return (local == null || local.isEmpty)
? null
: '$local\\flutter_gemma\\native';
}
final home = env['HOME'];
if (home == null || home.isEmpty) return null;
if (Platform.isMacOS) return '$home/Library/Caches/flutter_gemma/native';
return '$home/.cache/flutter_gemma/native';
}