update code
This commit is contained in:
parent
000b2e1f10
commit
427a6255f5
1 changed files with 11 additions and 1 deletions
|
|
@ -68,7 +68,11 @@ Map<String, dynamic>? getMapFromJson(String jsonStr) {
|
|||
Map<String, dynamic>? getMapFromYaml(String yamlStr) {
|
||||
Map<String, dynamic>? map;
|
||||
if (yamlStr.length > 5) {
|
||||
map = jsonDecode(jsonEncode(loadYaml(yamlStr)));
|
||||
try {
|
||||
map = jsonDecode(jsonEncode(loadYaml(yamlStr)));
|
||||
} on Exception catch (e, stacktace) {
|
||||
throw Exception('Yaml Pasing error.');
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
@ -96,6 +100,12 @@ Future get simpleFuture {
|
|||
return c.future;
|
||||
}
|
||||
|
||||
Future<T> dataFutrue<T>(T data) {
|
||||
var c = Completer<T>();
|
||||
c.complete(data);
|
||||
return c.future;
|
||||
}
|
||||
|
||||
Future<Uint8List?> readFileByte(String filePath) async {
|
||||
var c = Completer<Uint8List>();
|
||||
Uri myUri = Uri.parse(filePath);
|
||||
|
|
|
|||
Loading…
Reference in a new issue