initialize method Null safety

void initialize(
  1. {double intensity = 1.0,
  2. bool debug = false,
  3. bool suppressTorchErrors = false}
)

Initialize configurations that you want to initialize your controller.

Must be runner on main.dart before call runApp. It will ensure that the controller instance will be available within all your app

  • double intensity: Sets the default intensity of the torch. Only relevant on iOS
  • debug: Enable/disable debugPrint of error thrown by the methods
  • suppressTorchErrors: Suppress native errors from the usage of the torch in different devices. Active this if you don't want or need to handle torch errors

Implementation

void initialize(
    {double intensity = 1.0,
    bool debug = false,
    bool suppressTorchErrors = false}) async {
  _ensureInitialized = true;
  _debug = debug;
  _torchIntensity = intensity;
  _suppressTorchErrors = suppressTorchErrors;
}