flutter - flutter_quill Errors After Installation and Following Documentation - Stack Overflow

admin2025-04-18  3

I installed flutter_quill: ^9.3.0 and followed the official documentation, but I'm encountering multiple build errors.

The errors I am getting

/../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_quill-9.3.0/lib/src/widgets/raw_editor/raw_editor_state.dart:803:35: Error: The getter 'isAltPressed' isn't defined for the class 'HardwareKeyboard'. controller.indentSelection(!HardwareKeyboard.instance.isShiftPressed);./../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_quill-9.3.0/lib/src/widgets/raw_editor/raw_editor_state.dart:912:61: Error: The getter 'isShiftPressed' isn't defined for the class 'HardwareKeyboard'.
 - 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('/C:/dev/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isShiftPressed'.
      controller.indentSelection(!HardwareKeyboard.instance.isShiftPressed);
                                                            ^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception


FAILURE: Build failed with an exception.

((There are more similar errors.)

Here is my widget.

import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';

class MoodJournalPage extends StatelessWidget {
  const MoodJournalPage({super.key});

  @override
  Widget build(BuildContext context) {
    QuillController _controller = QuillController.basic();
    return Scaffold(
      body:Column(
        children: [
             QuillSimpleToolbar(
        configurations: QuillSimpleToolbarConfigurations(
          controller: _controller,
        ),
      ),
      Expanded(
        child: QuillEditor.basic(
          configurations:  QuillEditorConfigurations(
            controller: _controller,
          ),
        ),
      ),

        ],
      )
      
    
    );
  }
}

I installed flutter_quill as per the documentation. I ran flutter clean and flutter pub get. I tried different Flutter versions to check compatibility and downgraded flutter_quill. However, I am still facing issues.

转载请注明原文地址:http://anycun.com/QandA/1744935167a89706.html