flutter - MissingPluginException(未找到通道唤醒锁上的方法切换的实现) - 颤振唤醒锁
问题描述
当我使用唤醒锁时,我在调试控制台中收到此错误:
E/flutter (17630): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method toggle on channel wakelock)
这是我的代码:
import 'package:wakelock/wakelock.dart';
class _MyHomePageState extends State<MyHomePage> {
bool on = true;
// The following statement enables the wakelock.
void initState() {
super.initState();
Wakelock.toggle(on: on);
}
我也确实在我的 AndroidManifest.xml 中添加了这个 <uses-permission android:name="android.permission.WAKE_LOCK" />
这在依赖项中:wakelock: ^0.1.4+2
我该如何解决这个问题?
解决方案
停止调试器,在终端中执行“flutter clean”并重新启动应用程序。
推荐阅读
- python-3.x - oauth2session dynamics365:不断收到错误 401 未授权
- javascript - 长度为 n 且 k 连续为 1 的二进制数组的数量
- postgresql - Nominatim - pgsql 返回错误代码 (3)
- r - R中空间缓冲区的for循环问题
- c# - 统一的 3D 精灵的运动不起作用
- python - 使用 HTML 从我的 RASPBERRY 输出数据
- java - 拖动达到垂直限制时,文本出现故障
- c# - 如何在不同的命名空间中使用 WPF 用户控件
- sql - 显示列具有超过 1 个唯一值的记录
- javascript - 如何用 rest 语法重写状态