device_display_brightness 0.0.6 copy "device_display_brightness: ^0.0.6" to clipboard
device_display_brightness: ^0.0.6 copied to clipboard

A Flutter plugin to manage the device's display brightness on Android and iOS.

device_display_brightness #

pub package

A Flutter plugin to manage the device's display brightness on Android and iOS.

Usage #

Android setup #

Add this permission to AndroidManifest.xml

<uses-permission android:name="android.permission.WAKE_LOCK" />

iOS setup #

No setup needed.

Install #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  device_display_brightness: <latest_version>

In your library add the following import:

import 'package:device_display_brightness/device_display_brightness.dart';

Example #

// Set the brightness:
DeviceDisplayBrightness.setBrightness(0.13);

// Get the current brightness:
double brightness = await DeviceDisplayBrightness.getBrightness();

// Check if device's display is keeping turned on:
bool isKeptOn = await DeviceDisplayBrightness.isKeptOn();

// Prevent display from going into sleep mode:
DeviceDisplayBrightness.keepOn(enabled: true);

// Android only
// Resets brightness to system value.
DeviceDisplayBrightness.resetBrightness();
18
likes
140
pub points
88%
popularity

Publisher

verified publishersominviacheslav.tech

A Flutter plugin to manage the device's display brightness on Android and iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on device_display_brightness