setPreferredMode static method

Future<void> setPreferredMode(
  1. DisplayMode mode
)

setPreferredMode changes the preferred mode. It is upto the system to use this. Sometimes system can choose not switch to this based on internal heuristics. Check active to see if it actually switches.

Implementation

static Future<void> setPreferredMode(DisplayMode mode) async {
  return await _channel.invokeMethod<void>(
    'setPreferredMode',
    <String, dynamic>{'mode': mode.id},
  );
}