create static method
Creates a FlexDelegate asynchronously.
This is required on Android where the delegate is created via a method channel to the Java FlexDelegate API. On other platforms this behaves identically to the synchronous constructor.
Implementation
static Future<FlexDelegate> create() async {
if (Platform.isAndroid) {
final handle = await _channel.invokeMethod<int>('createFlexDelegate');
if (handle == null || handle == 0) {
throw UnsupportedError(
'FlexDelegate not available on Android.\n'
'Add flutter_litert_flex to your pubspec.yaml.',
);
}
return FlexDelegate._(
Pointer<TfLiteDelegate>.fromAddress(handle),
isAndroid: true,
);
}
return FlexDelegate();
}