simplify code of loading image file
This commit is contained in:
parent
3bfd2bf74b
commit
e3ad9b637e
@ -25,8 +25,7 @@ class PhotoProvider extends ImageProvider<PhotoProvider> {
|
|||||||
assert(key == this);
|
assert(key == this);
|
||||||
final file = await PhotoGallery.getFile(
|
final file = await PhotoGallery.getFile(
|
||||||
mediumId: mediumId, mediumType: MediumType.image, mimeType: mimeType);
|
mediumId: mediumId, mediumType: MediumType.image, mimeType: mimeType);
|
||||||
final bytes = await file.readAsBytes();
|
ui.ImmutableBuffer buffer = await ui.ImmutableBuffer.fromFilePath(file.path);
|
||||||
ui.ImmutableBuffer buffer = await ui.ImmutableBuffer.fromUint8List(bytes);
|
|
||||||
return decode(buffer);
|
return decode(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user