Skip to content

getText() doesn't work first time when it's called #32

@misici234

Description

@misici234

I noticed that getText() doesn't work first time when it's called. When I wait a little bit and call it again then I get the HTML content from FlutterSummernote() widget. I implemented following and ugly workaround to this problem.


GlobalKey<FlutterSummernoteState> keyEditor = GlobalKey();
...
                        progressNote.prnoMemo = await keyEditor.currentState?.getText();
                        // getText() is buggy and doesn't work first time when it's called
                        await Future.delayed(Duration(milliseconds: 500));
                        progressNote.prnoMemo = await keyEditor.currentState?.getText();
                        print('from HTML editor :  ${progressNote.prnoMemo}');
...
              FlutterSummernote(
                height: 350,
                value: progressNote.prnoMemo,
                hint: progressNote.prnoMemo == null ? 'Enter your note here...' : '',
                key: keyEditor,
...


Please investigate and resolve this problem.
I use flutter_summernote: ^0.2.3 in my pubspec.yaml file and
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions