wait for plugin initialization before returning via FlutterFilamentPlugin.create
This commit is contained in:
@@ -48,20 +48,22 @@ class FlutterFilamentPlugin extends FilamentViewer {
|
|||||||
? nullptr
|
? nullptr
|
||||||
: Pointer<Void>.fromAddress(sharedContext);
|
: Pointer<Void>.fromAddress(sharedContext);
|
||||||
|
|
||||||
return FlutterFilamentPlugin._(channel,
|
var plugin = FlutterFilamentPlugin._(channel,
|
||||||
renderCallback: renderCallback,
|
renderCallback: renderCallback,
|
||||||
renderCallbackOwner: renderCallbackOwner,
|
renderCallbackOwner: renderCallbackOwner,
|
||||||
resourceLoader: resourceLoader,
|
resourceLoader: resourceLoader,
|
||||||
driver: driverPtr,
|
driver: driverPtr,
|
||||||
sharedContext: sharedContextPtr,
|
sharedContext: sharedContextPtr,
|
||||||
uberArchivePath: uberArchivePath);
|
uberArchivePath: uberArchivePath);
|
||||||
|
await plugin.initialized;
|
||||||
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<FlutterFilamentTexture?> createTexture(
|
Future<FlutterFilamentTexture?> createTexture(
|
||||||
int width, int height, int offsetLeft, int offsetRight) async {
|
int width, int height, int offsetLeft, int offsetRight) async {
|
||||||
var result = await _channel
|
var result = await _channel
|
||||||
.invokeMethod("createTexture", [width, height, offsetLeft, offsetLeft]);
|
.invokeMethod("createTexture", [width, height, offsetLeft, offsetLeft]);
|
||||||
|
|
||||||
if (result == null || result[0] == -1) {
|
if (result == null || result[0] == -1) {
|
||||||
throw Exception("Failed to create texture");
|
throw Exception("Failed to create texture");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user