FlexDelegate constructor

FlexDelegate()

Creates a FlexDelegate for SELECT_TF_OPS support.

Requires flutter_litert_flex in your pubspec.yaml.

Throws UnsupportedError on Android, where flex was removed in flutter_litert 4.0.0, and if the library cannot be loaded.

Implementation

factory FlexDelegate() {
  if (_isAndroid) {
    throw UnsupportedError(_androidRemovedMessage);
  }
  _loadLibrary();
  final delegate = _createFn!(nullptr, nullptr, 0, nullptr);
  checkArgument(
    delegate != nullptr,
    message: 'Failed to create FlexDelegate (native returned null).',
  );
  return FlexDelegate._(delegate);
}