MethodChannelTorchFlashlight class

An implementation of TorchFlashlightPlatform that uses method channels.

Inheritance

Properties

eventChannel EventChannel
The event channel used to receive torch state changes.
final
hashCode int
The hash code for this object.
no setterinherited
methodChannel MethodChannel
The method channel used to interact with the native platform.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
torchState Stream<bool>
Returns a stream of torch state changes.
no setteroverride

Methods

disableTorch() Future<void>
Disables the torch.
override
enableTorch({FlashMode mode = FlashMode.torch}) Future<void>
Enables the torch with specified flash mode. mode - The flash mode to use (torch or flash).
override
getCapabilities() Future<TorchCapabilities>
Returns the capabilities of the torch on the current platform.
override
getCurrentTorchStrength() Future<int>
Returns the current torch strength level. Returns 0 if not supported or torch is off.
override
getMaxTorchStrength() Future<int>
Returns the maximum torch strength level supported by the device. Returns 0 if not supported.
override
isTorchAvailable() Future<bool>
Checks if the torch is available on the device.
override
isTorchOn() Future<bool>
Returns the current torch state (true if on, false if off).
override
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.
override
startForegroundService() Future<void>
Starts foreground service for background torch operation (Android only). Required for torch to continue working when app is in background.
override
Starts native periodic blinking for better performance. interval - The interval between on/off toggles in milliseconds.
override
stopForegroundService() Future<void>
Stops foreground service (Android only).
override
Stops native periodic blinking.
override
toString() String
A string representation of this object.
inherited

Operators

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