setAppearanceConfig method

String setAppearanceConfig(
  1. BuildContext context, {
  2. String type = "system",
  3. bool notify = true,
})

Implementation

String setAppearanceConfig(BuildContext context,
    {String type = "system", bool notify = true}) {
  String appearance = ""; // only light or dark (no system)

  appearanceConfig = type;
  if (appearanceConfig == "system") {
    var brightness = MediaQuery.of(context).platformBrightness;
    appearance = (brightness == Brightness.light) ? "light" : "dark";
  } else {
    appearance = appearanceConfig;
  }

  _setAppearance(appearance, notify: notify);

  return appearance;
}