supported property Null safety

Future<List<DisplayMode>> supported

supported returns all the modes that can be set as the preferred mode. This always returns DisplayMode.auto as one of the modes.

Implementation

static Future<List<DisplayMode>> get supported async {
  final List<dynamic> rawModes =
      (await _channel.invokeMethod<List<dynamic>>('getSupportedModes'))!;
  final List<DisplayMode> modes = rawModes.map((dynamic i) {
    final Map<String, dynamic> item =
        (i as Map<dynamic, dynamic>).cast<String, dynamic>();
    return DisplayMode.fromJson(item);
  }).toList();
  modes.insert(0, DisplayMode.auto);
  return modes;
}