Flushbar plugin: Error: The method 'attach' isn't defined for the class 'FocusScopeNode'

Flushbar plugin: Error: The method 'attach' isn't defined for the class 'FocusScopeNode'

我之前的项目我使用flushbar插件没有任何错误。但是我的新项目在尝试使用 flushbar 时出现错误..

项目在没有 flushbar 的情况下运行良好。

完整的错误信息

Compiler message:
file:///Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.7.0/lib/flushbar.dart:207:3: Error: Type 'FocusAttachment' not found.
  FocusAttachment _focusAttachment;
  ^^^^^^^^^^^^^^^
file:///Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.7.0/lib/flushbar.dart:207:3: Error: 'FocusAttachment' isn't a type.
  FocusAttachment _focusAttachment;
  ^^^^^^^^^^^^^^^
file:///Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.7.0/lib/flushbar.dart:228:35: Error: The method 'attach' isn't defined for the class 'FocusScopeNode'.
 - 'FocusScopeNode' is from 'package:flutter/src/widgets/focus_manager.dart' ('file:///Users/bhanukaisuru/Documents/flutter/packages/flutter/lib/src/widgets/focus_manager.dart').
Try correcting the name to the name of an existing method, or defining a method named 'attach'.
    _focusAttachment = _focusNode.attach(context);
                                  ^^^^^^
file:///Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.7.0/lib/flushbar.dart:239:16: Error: The method 'dispose' isn't defined for the class 'FocusScopeNode'.
 - 'FocusScopeNode' is from 'package:flutter/src/widgets/focus_manager.dart' ('file:///Users/bhanukaisuru/Documents/flutter/packages/flutter/lib/src/widgets/focus_manager.dart').
Try correcting the name to the name of an existing method, or defining a method named 'dispose'.
    _focusNode.dispose();

这四个版本我都试过了,没啥变化

  flushbar: ^1.3.0
  flushbar: ^1.5.3
  flushbar: ^1.7.0
  flushbar: ^1.6.0

我也用过,

  FocusScope.of(context).requestFocus(FocusNode()),

flutter升级后我遇到了同样的问题。 暂时从 pubspec.yaml 中删除 ^ 。它应该可以工作。

 flushbar: 1.5.3

参考:https://github.com/flutter/flutter/issues/33827