Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type 'Null' is not a subtype of type 'WidgetsLocalizations' in type cast #2098

Closed
1 task done
Xoshbin opened this issue Aug 10, 2024 · 2 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@Xoshbin
Copy link
Contributor

Xoshbin commented Aug 10, 2024

Is there an existing issue for this?

Flutter Quill version

10.1.9

Steps to reproduce

Setup Quill with a language that is not supported in Flutter but in Quill like Kurdish, and run the app

Expected results

Show the Quill editor

Actual results

When i run my App that have a screen with Quill editor with a language like English it's showing the editor but for Kurdish language whereas the locale file available in Quill but it's giving the error above.

and this is the merge commit that I added the missing Kurdish phrases #2029

@Xoshbin Xoshbin added the bug Something isn't working label Aug 10, 2024
@AtlasAutocode
Copy link
Collaborator

Firstly, I am NOT an expert on localizations.

I note that you understand that Kurdish is not supported by Flutter. There is a lot of early startup code that checks to make sure that flutter apps have access to Localizations. I assume this is because flutter's internal operations have many dependencies, and flutter might not work correctly without this localization support.

On my windows desktop, the code seems to expect MaterialLocalizations will be present. Theme.of expects an instance of this class and is called frequently.

Localization support is provided in the startup code for your app:

            localizationsDelegates: const [
              GlobalMaterialLocalizations.delegate,
              GlobalWidgetsLocalizations.delegate,
              GlobalCupertinoLocalizations.delegate,
              // Uncomment this line to use provide flutter quill localizations
              // in your widgets app, otherwise the quill widgets will provide it
              // internally:
              // FlutterQuillLocalizations.delegate,
            ],

Uncommenting the last line does not provide the missing localization type.
I expect you are going to have to provide your own localizations delegate to bypass flutter's default behavior and provide the missing localization of type appropriate to your environment.

Can you contact the Flutter localization team to ask them to support Kurdish? This would make it easy to fix this problem.

@Xoshbin
Copy link
Contributor Author

Xoshbin commented Aug 12, 2024

@AtlasAutocode Thank you for helping, even though I have tried multiple times before without working, but this time after making sure I'm doing the right thing and after a flutter clean it did work.

localizationsDelegates: const [
                    AppLocalizations.delegate,
                    GlobalMaterialLocalizations.delegate,
                    GlobalWidgetsLocalizations.delegate,
                    GlobalCupertinoLocalizations.delegate,
                    KuMaterialLocalizations.delegate,
                    KuCupertinoLocalizations.delegate,
                    KuWidgetLocalizations.delegate,
                    FlutterQuillLocalizations.delegate,
                  ],

@Xoshbin Xoshbin closed this as completed Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants