-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test qr embeded image implementation
- Loading branch information
1 parent
7ece442
commit d81742a
Showing
2 changed files
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'dart:async'; | ||
import 'dart:ui' as ui; | ||
import 'dart:typed_data'; | ||
import 'package:flutter/material.dart'; | ||
|
||
Future<ui.Image> loadImage(BuildContext context, String assetPath) async { | ||
final ByteData data = await DefaultAssetBundle.of(context).load(assetPath); | ||
final Completer<ui.Image> completer = Completer(); | ||
ui.decodeImageFromList(data.buffer.asUint8List(), (ui.Image img) { | ||
return completer.complete(img); | ||
}); | ||
return completer.future; | ||
} |