mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
add asset validation
This commit is contained in:
15
lib/utils/asset_validator.dart
Normal file
15
lib/utils/asset_validator.dart
Normal file
@ -0,0 +1,15 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class AssetValidator {
|
||||
static Future<bool> isValidAsset(String? assetPath) async {
|
||||
if (assetPath == null || assetPath.isEmpty) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
await rootBundle.load(assetPath);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user