flashlight_plugin 0.0.1 copy "flashlight_plugin: ^0.0.1" to clipboard
flashlight_plugin: ^0.0.1 copied to clipboard

PlatformAndroid

A Flutter Plugin to control the flashlight on android devices that are Android 6.0 or higher

flashlight_plugin #

A Flutter plugin to control the device flashlight on Android.

Features #

  • Turn flashlight on/off
  • Check flashlight availability
  • Toggle flashlight state

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flashlight_plugin: ^0.0.1

Usage #

import 'package:flashlight_plugin/flashlight_plugin.dart';

// Check if flashlight is available
bool hasFlash = await FlashlightPlugin.hasFlashlight();

// Turn on the flashlight
await FlashlightPlugin.turnOn();

// Turn off the flashlight
await FlashlightPlugin.turnOff();

// Toggle flashlight
await FlashlightPlugin.toggle();

Android Setup #

Add the following permissions to your android/app/src/main/AndroidManifest.xml:

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

Requirements #

  • Android API 23 (Android 6.0) or higher
  • Flutter 3.0.0 or higher

LICENSE #

MIT License

0
likes
160
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter Plugin to control the flashlight on android devices that are Android 6.0 or higher

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flashlight_plugin

Packages that implement flashlight_plugin