mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-05-12 19:20:42 +00:00
17 lines
569 B
Dart
17 lines
569 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
class CaffeineService {
|
|
@visibleForTesting
|
|
static const caffeineMethodChannel = MethodChannel("com.vodemn.lightmeter.CaffeinePlatformChannel.MethodChannel");
|
|
|
|
const CaffeineService();
|
|
|
|
Future<bool> isKeepScreenOn() async {
|
|
return caffeineMethodChannel.invokeMethod<bool>("isKeepScreenOn").then((value) => value!);
|
|
}
|
|
|
|
Future<bool> keepScreenOn(bool keep) async {
|
|
return caffeineMethodChannel.invokeMethod<bool>("setKeepScreenOn", keep).then((value) => value!);
|
|
}
|
|
}
|