setCustomBrandingImage static method

Future<void> setCustomBrandingImage({
  1. required AssetImage light,
  2. required AssetImage dark,
  3. BuildContext? context,
})

Sets a custom branding image logo with light and dark images for different color modes.

If no context is passed, asset variants won't work as expected; if you have different variants of the light or dark image assets make sure to pass the context in order for the right variant to be picked up.

Implementation

static Future<void> setCustomBrandingImage({
  required AssetImage light,
  required AssetImage dark,
  BuildContext? context,
}) async {
  var configuration = ImageConfiguration.empty;
  if (context != null) {
    configuration = createLocalImageConfiguration(context);
  }

  final lightKey = await light.obtainKey(configuration);
  final darkKey = await dark.obtainKey(configuration);
  return _host.setCustomBrandingImage(lightKey.name, darkKey.name);
}