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 isKeepScreenOn() async { return caffeineMethodChannel.invokeMethod("isKeepScreenOn").then((value) => value!); } Future keepScreenOn(bool keep) async { return caffeineMethodChannel.invokeMethod("setKeepScreenOn", keep).then((value) => value!); } }