icapps_torch_compat 2.0.0 copy "icapps_torch_compat: ^2.0.0" to clipboard
icapps_torch_compat: ^2.0.0 copied to clipboard

Plugin to turn on / off the torch (or flash of the camera) on all supported versions of Android (4.1+) and iOS

Torch compat #

Pub

A plugin to enable or disable the torch of a device that works both on Android (including Android 4.x) and ioS.

NOTE: For older Android devices #

Some older Android devices have been known to crash when requesting access to the device torch. This is the result of a bug on those devices requiring full camera access in order to control the camera flash.

This plugin by default only requests android.permission.FLASHLIGHT, but if you need your app to be compatible with more devices, you can add the following lines to your application's AndroidManifest.xml

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-feature android:name="android.hardware.camera.flash" />

Getting started #

1) Dependency setup #

First import the library to your project in your pubspec.yaml:

icapps_torch_compat: ^2.0.0

2) Import the library in your Dart code #

import 'package:icapps_torch_compat/icapps_torch_compat.dart';

3) Turn on or off the flash #

TorchCompat.turnOn();
TorchCompat.turnOff();  
0
likes
110
pub points
55%
popularity

Publisher

verified publishericapps.com

Plugin to turn on / off the torch (or flash of the camera) on all supported versions of Android (4.1+) and iOS

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on icapps_torch_compat