screenBrightness method Null safety

Future<double> screenBrightness()

Get the screen brightness. The range of returned value is 0.0, 1.0

Implementation

static Future<double> screenBrightness() async {
  if (Platform.isAndroid || Platform.isIOS) {
    var brightness = await _channel.invokeMethod("brightness");
    if (brightness != null) return Future.value(brightness);
  }
  return Future.value(0);
}