SuperuserPlatform constructor

SuperuserPlatform()

Create SuperuserPlatform for targeted platform.

Usually, it should performs binding from plugin to ensure SuperuserInterface's properties can be fetched.

This cannot be used in testing environment and UnsupportedError throw if attempted to construst in testing.

Implementation

SuperuserPlatform() {
  if (Platform.environment.containsKey("FLUTTER_TEST") ||
      Platform.script.path.contains("dart_test")) {
    throw UnsupportedError(
      "Using real superuser result to run test is forbidden.",
    );
  }
}