getAdaptiveIcon static method

Future<AdaptiveIcon> getAdaptiveIcon()

Loads the app icon as an AdaptiveIcon. This should be PNG encoded, but it is not guaranteed to be a PNG.

If the AdaptiveIcon is a vector it gets rasterized because there is currently no way to export Androids Vector Drawables as the original XML file. Even then there would be no way to display them as a vector image.

Throws an exception on platforms other than Android.

Implementation

static Future<AdaptiveIcon> getAdaptiveIcon() async {
  if (!Platform.isAndroid) {
    throw Exception('getAdaptiveIcon is only supported on Android');
  }
  final foreground = await _getAdaptiveForeground();
  final background = await _getAdaptiveBackground();

  return AdaptiveIcon(
    foreground: foreground,
    background: background,
  );
}