getStoragePaths static method
Gets the available storage paths for the app.
Returns a map containing paths to different storage locations:
- 'internal': App's internal storage directory
- 'cache': App's cache directory
- 'external': App's external storage directory (may be null)
- 'externalCache': App's external cache directory (may be null)
These paths can be used to save or load models.
Implementation
static Future<Map<String, String?>> getStoragePaths() async {
try {
final result = await _channel.invokeMethod('getStoragePaths');
if (result is Map) {
return Map<String, String?>.fromEntries(
result.entries.map((e) => MapEntry(e.key.toString(), e.value as String?))
);
}
return {};
} on PlatformException catch (e) {
print('Failed to get storage paths: ${e.message}');
return {};
} catch (e) {
print('Error getting storage paths: $e');
return {};
}
}