flutter_lantern 0.0.1
flutter_lantern: ^0.0.1 copied to clipboard

Flutter Android iOS

A new flutter plugin project.

Lantern #

pub package A Flutter plugin to access the device's lantern/torch on Android and iOS.

Usage #

To use this plugin, add lantern as a dependency in your pubspec.yaml file.

It works on Android Pie !!

For android, add the following to your manifest

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

and change the minSDK in the app build.graddle

minSdkVersion 21

Example #

// Import package
import 'package:flutter_lantern/flutter_lantern.dart';

// Turn the lamp on:

// Turn the lamp off:

// Turn the lamp with a specific intensity (only affects iOS as of now):
Lantern.turnOn(intensity: 0.4);

// Check if the device has a lamp:
bool hasLamp = await Lantern.hasLamp;