在我的Flutter desktop
项目中,我正在尝试使用window_size插件(在 Windows 10 上)来尝试设置窗口的最大尺寸。我在下面添加了插件pubspec.yaml
:
依赖项:
...
window_size:
git:
url: https://github.com/google/flutter-desktop-embedding
path: plugins/window_size
然后我将其导入main.dart
:
import 'package:window_size/window_size.dart' as window_size;
当我调用类似的方法getWindowMaxSize
或者setWindowMaxSize
我得到这样的错误时:
[ERROR:c:\b\s\w\ir\cache\builder\src\flutter\lib\ui\ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getWindowMaximumSize on channel flutter/windowsize)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
<asynchronous suspension>
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#2 WindowSizeChannel.getWindowMaxSize (package:window_size/src/window_size_channel.dart:202:32)
#3 getWindowMaxSize (package:window_size/src/window_size_utils.dart:83:37)
我可以做些什么来修复它,也许通过安装特定的插件版本?
其他插件功能,getCurrentScreen
例如正在工作。