Search code examples
flutterdartflutter-webquill

Flutter Quill for Web Development


I'm having a issue with Flutter Quill package. I want to use it in web development but I'm not able to work it out.

The pub.dev page says that "It is required to provide EmbedBuilder, e.g. defaultEmbedBuilderWeb." but whatever I do I get the following error

"/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-1.4.1/lib/src/widgets/text_selection.dart:442:58: Error: Too few positional arguments: 4 required, 3 given. child: widget.selectionControls.buildHandle("

Here's my code snippet

class _HomePageState extends State<HomePage> {
  QuillController _controller = QuillController.basic();
  final FocusNode _focusNode = FocusNode();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(),
        body: Container(
          child: Column(
          children: [
            QuillToolbar.basic(controller: _controller),
            Expanded(
              child: Container(
                  child: QuillEditor(
                      controller: _controller,
                      scrollController: ScrollController(),
                      scrollable: true,
                      focusNode: _focusNode,
                      autoFocus: false,
                      readOnly: false,
                      placeholder: 'Add content',
                      expands: false,
                      padding: EdgeInsets.zero,
                      embedBuilder: defaultEmbedBuilderWeb)),
                    )
            ],
   )));
  }
}

I don't know what to do to use flutter quill in webapps, thanks in advance.


Solution

  • The current version of flutter quill will probably work for you. At least it won't generate the error you were getting. I'm posting this for others to take note. The version in June 2021 was 1.4.1 and the version in Nov. 2021 is 2.0.15. I'm able to run similar code in android studio debugging using Chrome and the editor works (all using the current versions: flutter 2.5, flutter quill 2.0.15).