load static method

Future<Uint8List?> load(
  1. NativeImageType type,
  2. String name, {
  3. double? width,
  4. double? height,
  5. double? scale,
  6. Brightness? brightness,
})

Loads an image of type named name. name is ignored for NativeImageType.appIcon.

Implementation

static Future<Uint8List?> load(
  NativeImageType type,
  String name, {
  double? width,
  double? height,
  double? scale,
  Brightness? brightness,
}) async {
  try {
    return await _channel.invokeMethod<Uint8List>("load", {
      "type": type.name,
      "name": name,
      "width": width,
      "height": height,
      "scale": scale ?? _deviceScale,
      if (brightness != null) "dark": brightness == Brightness.dark,
    });
  } on PlatformException catch (error) {
    if (error.code == "NOT_FOUND") return null;
    rethrow;
  }
}