Skip to content
pubscout

torch_controller

2.0.1, released 4 years ago by an unverified publisher

A Flutter plugin to manage and toggle the device torch or flashlight.

$ flutter pub add torch_controller
Source repository

What it does

Provides a controller to natively check torch status, toggle flashlight on and off, and access native resources. It requires initialization before the app runs.

AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to build a flashlight utility app.
  • Your application requires turning the device's torch on or off programmatically.

Skip it when

  • You need camera preview or QR code scanning capabilities rather than just flash control.

Strengths

  • Simple singleton controller interface
  • Supports toggling lights and returning current state easily

Weaknesses

  • Requires explicit initialization before runApp
  • Limited to flashlight control functionality

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
0

Initialize TorchController by calling TorchController().initialize() before your runApp in main.dart.

void main() {
  TorchController().initialize();
  runApp(const MyApp());
}

final torchController = TorchController();
bool active = torchController.toggle();

Alternatives

Packages that do the same job and could replace torch_controller.