m3_lightmeter/lib/data/caffeine_service.dart

16 lines
441 B
Dart
Raw Normal View History

2023-02-11 12:54:06 +00:00
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);
}
}