TorchFlashlightPlatform class abstract

Inheritance
  • Object
  • PlatformInterface
  • TorchFlashlightPlatform
Implementers

Constructors

TorchFlashlightPlatform()
Constructs a TorchFlashlightPlatform.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
torchState Stream<bool>
Returns a stream of torch state changes.
no setter

Methods

disableTorch() Future<void>
Disables the torch.
enableTorch({FlashMode mode = FlashMode.torch}) Future<void>
Enables the torch with specified flash mode. mode - The flash mode to use (torch or flash).
getCapabilities() Future<TorchCapabilities>
Returns the capabilities of the torch on the current platform.
getCurrentTorchStrength() Future<int>
Returns the current torch strength level. Returns 0 if not supported or torch is off.
getMaxTorchStrength() Future<int>
Returns the maximum torch strength level supported by the device. Returns 0 if not supported.
isTorchAvailable() Future<bool>
Checks if the torch is available on the device.
isTorchOn() Future<bool>
Returns the current torch state (true if on, false if off).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setTorchStrength(int strength) Future<void>
Sets the torch strength level. strength should be between 0 and getMaxTorchStrength(). Throws an error if not supported by the device.
startForegroundService() Future<void>
Starts foreground service for background torch operation (Android only). Required for torch to continue working when app is in background.
Starts native periodic blinking for better performance. interval - The interval between on/off toggles in milliseconds.
stopForegroundService() Future<void>
Stops foreground service (Android only).
Stops native periodic blinking.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance TorchFlashlightPlatform
The default instance of TorchFlashlightPlatform to use.
getter/setter pair