我正在开发一个Flutter项目,我的Dart和Flutter SDK是Flutter:Flutter 3.3.10 Dart:Dart 2.18.6,我使用的是quill版本:6.4.2 但在运行应用程序时,我收到这些错误:
Launching lib\main.dart on Chrome in debug mode...
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:308:8: Error: Type 'ContextMenuButtonItem' not found.
List<ContextMenuButtonItem> get contextMenuButtonItems {
^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:327:3: Error: Type 'TextSelectionToolbarAnchors' not found.
TextSelectionToolbarAnchors get contextMenuAnchors {
^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:1516:7: Error: Type 'TextInputControl' not found.
TextInputControl? oldControl, TextInputControl? newControl) {
^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:1516:37: Error: Type 'TextInputControl' not found.
TextInputControl? oldControl, TextInputControl? newControl) {
^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:125:12: Error: Undefined name 'AdaptiveTextSelectionToolbar'.
return AdaptiveTextSelectionToolbar.buttonItems(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:309:25: Error: Member not found: 'EditableText.getEditableButtonItems'.
return EditableText.getEditableButtonItems(
^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:331:12: Error: The getter 'TextSelectionToolbarAnchors' isn't defined for the
class 'RawEditorState'.
- 'RawEditorState' is from 'package:flutter_quill/src/widgets/raw_editor.dart'
('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'TextSelectionToolbarAnchors'.
return TextSelectionToolbarAnchors.fromSelection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:1516:7: Error: 'TextInputControl' isn't a type.
TextInputControl? oldControl, TextInputControl? newControl) {
^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:1516:37: Error: 'TextInputControl' isn't a type.
TextInputControl? oldControl, TextInputControl? newControl) {
^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:1522:20: Error: The method 'intentForMacOSSelector' isn't defined for the class
'RawEditorState'.
- 'RawEditorState' is from 'package:flutter_quill/src/widgets/raw_editor.dart'
('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart').
Try correcting the name to the name of an existing method, or defining a method named 'intentForMacOSSelector'.
final intent = intentForMacOSSelector(selectorName);
^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/raw_editor.dart:1527:17: Error: Inferred type argument 'dynamic' doesn't conform to the bound
'Intent' of the type variable 'T' on 'Actions.invoke'.
- 'Intent' is from 'package:flutter/src/widgets/actions.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/actions.dart').
- 'Actions' is from 'package:flutter/src/widgets/actions.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/actions.dart').
Try specifying type arguments explicitly so that they conform to the bounds.
Actions.invoke(primaryContext, intent);
^
/C:/flutter/packages/flutter/lib/src/widgets/actions.dart:860:25: Context: This is the type variable whose bound isn't conformed to.
static Object? invoke<T extends Intent>(
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/text_selection.dart:228:10: Error: Method 'insert' cannot be called on 'OverlayState?' because
it is potentially null.
- 'OverlayState' is from 'package:flutter/src/widgets/overlay.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/overlay.dart').
Try calling using ?. instead.
.insert(toolbar!);
^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/text_selection.dart:354:10: Error: Method 'insertAll' cannot be called on 'OverlayState?'
because it is potentially null.
- 'OverlayState' is from 'package:flutter/src/widgets/overlay.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/overlay.dart').
Try calling using ?. instead.
.insertAll(_handles!);
^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/toolbar/quill_font_family_button.dart:112:41: Error: Property 'context' cannot be accessed on
'OverlayState?' because it is potentially null.
- 'OverlayState' is from 'package:flutter/src/widgets/overlay.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/overlay.dart').
Try accessing using ?. instead.
final overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-6.4.2/lib/src/widgets/toolbar/quill_font_size_button.dart:113:41: Error: Property 'context' cannot be accessed on
'OverlayState?' because it is potentially null.
- 'OverlayState' is from 'package:flutter/src/widgets/overlay.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/overlay.dart').
Try accessing using ?. instead.
final overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
^^^^^^^
我尝试安装多个版本的 quill,但它显示了相同的问题。
我有同样的错误。根据Github上的回答,flutter quill不支持flutter beta通道,但稳定。因此,如果您处于测试版,则必须切换到稳定版
颤振通道稳定