Skip to content

Blankeye-zero/flashlight_plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Flutter Android plugin for managing android flashlight

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published