instance property Null safety

PenguinCameraPlatform instance

Current platform implementation of the platform interface.

If none has been explicitly set, the default implementations are used for their respective platforms.

Supported Default Platform Implementations: Android: android.CameraPlatform iOS: ios.CameraPlatform

Implementation

static PenguinCameraPlatform get instance {
  if (_instance != null) return _instance!;

  if (defaultTargetPlatform == TargetPlatform.android) {
    _instance = android.CameraPlatform();
  } else if (defaultTargetPlatform == TargetPlatform.iOS) {
    _instance = ios.CameraPlatform();
  } else {
    throw AssertionError('Current platform is not supported.');
  }

  return _instance!;
}
void instance=(PenguinCameraPlatform instance)

Platform-specific plugins should set this with their own platform-specific class that extends PenguinCameraPlatform when they register themselves.

Implementation

static set instance(PenguinCameraPlatform instance) {
  PlatformInterface.verifyToken(instance, _token);
  _instance = instance;
}