FlexDelegate constructor
FlexDelegate()
Creates a FlexDelegate for SELECT_TF_OPS support.
Requires flutter_litert_flex in your pubspec.yaml.
On Android this constructor throws because delegate creation uses a method channel. Use FlexDelegate.create for cross-platform code.
Throws UnsupportedError if the library cannot be loaded.
Implementation
factory FlexDelegate() {
if (Platform.isAndroid) {
throw UnsupportedError(
'On Android, call FlexDelegate.create() instead of FlexDelegate().\n'
'The Android FlexDelegate requires async initialization via method channel.',
);
}
_loadLibrary();
final delegate = _createFn!(nullptr, nullptr, 0, nullptr);
checkArgument(
delegate != nullptr,
message: 'Failed to create FlexDelegate (native returned null).',
);
return FlexDelegate._(delegate);
}