torch_light
2.0.0, released 6 months ago by davidserrano.io
Check if device has a torch and turn it on or off.
What it does
A Flutter plugin that checks if the device has an available torch/flashlight, and provides methods to enable and disable it. It includes specific exception handling for scenarios like camera in use or torch not available.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to turn the device flashlight on or off programmatically.
- You need to check if a torch is available on the current device.
Skip it when
- You are building a full camera application that handles video capturing and custom camera controls.
Strengths
- Simple and straightforward API for torch management
- Comprehensive error handling with specific exceptions
Weaknesses
- Limited to a single specific device feature (torch control)
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Requires Android SDK 6.0 (API level 23) or higher. Built-in Kotlin and Swift Package Manager support.
try {
final isTorchAvailable = await TorchLight.isTorchAvailable();
} on Exception catch (_) {
// Handle error
}
try {
await TorchLight.enableTorch();
} on Exception catch (_) {
// Handle error
}Alternatives
Packages that do the same job and could replace torch_light.
- google_api_availability
Check the availability of Google Play services on an Android device.
88Compare - safe_device
Detect jailbreak/root, emulator, mock location and other safety flags on iOS/Android devices.
87Compare - device_safety_info
Provides root, jailbreak, debugger, screenshot, VPN and other security checks for Flutter apps.
82Compare - torch_controller
A Flutter plugin to manage and toggle the device torch or flashlight.
47Compare