loadFlutterAsset method

  1. @override
Future<void> loadFlutterAsset(
  1. String key
)
override

Loads the Flutter asset specified in the pubspec.yaml file.

Throws an ArgumentError if key is not part of the specified assets in the pubspec.yaml file.

Implementation

@override
Future<void> loadFlutterAsset(String key) async {
  assert(key.isNotEmpty);

  try {
    return await _channel.invokeMethod<void>('loadFlutterAsset', key);
  } on PlatformException catch (ex) {
    if (ex.code == 'loadFlutterAsset_invalidKey') {
      throw ArgumentError(ex.message);
    }

    rethrow;
  }
}