loadImage static method
读取图片
Implementation
static Future<ui.Image> loadImage(String src) async {
if (!_files.containsKey(src)) {
final data = await rootBundle.load(src);
final bytes = Uint8List.view(data.buffer);
final completer = Completer<ui.Image>();
ui.decodeImageFromList(bytes, completer.complete);
_files[src] = completer.future;
}
return _files[src] as Future<ui.Image>;
}