checkModelExists static method
Checks if a model exists at the specified path.
This method can check for models in assets, internal storage, or at an absolute path.
@param modelPath The path to check @return A map containing information about the model existence and location
Implementation
static Future<Map<String, dynamic>> checkModelExists(String modelPath) async {
try {
final result = await _channel.invokeMethod('checkModelExists', {
'modelPath': modelPath,
});
if (result is Map) {
return Map<String, dynamic>.fromEntries(
result.entries.map((e) => MapEntry(e.key.toString(), e.value))
);
}
return {'exists': false, 'path': modelPath, 'location': 'unknown'};
} on PlatformException catch (e) {
print('Failed to check model existence: ${e.message}');
return {'exists': false, 'path': modelPath, 'error': e.message};
} catch (e) {
print('Error checking model existence: $e');
return {'exists': false, 'path': modelPath, 'error': e.toString()};
}
}