SuperuserPlatform constructor

SuperuserPlatform(
  1. DynamicLibrary nativeLibrary()
)

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(DynamicLibrary Function() nativeLibrary)
    : _nativeLibrary = nativeLibrary() {
  if (Platform.environment.containsKey("FLUTTER_TEST")) {
    throw UnsupportedError(
        "Using real superuser result to run test is forbidden.");
  }
}