readRaw method

Future<Uint8List> readRaw({
  1. required String resourceName,
})

Reads raw stored in the platform resource system.

On Android resourceName is resolved using the resource system and the raw resource type.

On iOS, a file named resourceName is being resolved from the main bundle and read fully.

If the property can not be resolved, a exception is thrown.

Implementation

Future<Uint8List> readRaw({
  required String resourceName,
}) async {
  if (defaultTargetPlatform == TargetPlatform.iOS) {
    return (await _channel.invokeMethod<Uint8List>('readRaw', resourceName))!;
  }

  return (await _channel.invokeMethod<Uint8List>('read', {
    'android-resource-name': resourceName,
    'resource-type': 'raw',
  }))!;
}