import 'package:flutter/services.dart'; class CaffeineService { static const _methodChannel = MethodChannel("com.vodemn.lightmeter/keepScreenOn"); const CaffeineService(); Future isKeepScreenOn() async { return _methodChannel.invokeMethod("isKeepScreenOn").then((value) => value!); } Future keepScreenOn(bool keep) async { return _methodChannel.invokeMethod("setKeepScreenOn", keep).then((value) => value!); } }