1

在我的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例如正在工作。

4

1 回答 1

2

这些方法目前仅适用于 macOS。您可以订阅此问题以获取有关 Windows 和 Linux 的更新。

于 2020-03-09T22:26:45.633 回答