mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 16:30:40 +00:00
16 lines
441 B
Dart
16 lines
441 B
Dart
|
import 'package:flutter/services.dart';
|
||
|
|
||
|
class CaffeineService {
|
||
|
static const _methodChannel = MethodChannel("com.vodemn.lightmeter/keepScreenOn");
|
||
|
|
||
|
const CaffeineService();
|
||
|
|
||
|
Future<bool> isKeepScreenOn() async {
|
||
|
return await _methodChannel.invokeMethod<bool>("isKeepScreenOn").then((value) => value!);
|
||
|
}
|
||
|
|
||
|
Future<void> keepScreenOn(bool keep) async {
|
||
|
await _methodChannel.invokeMethod<bool>("setKeepScreenOn", keep);
|
||
|
}
|
||
|
}
|