roipeker / flutter_translation_sheet

A super simple l10n tool with auto translations via GoogleSheet.
MIT License
43 stars 14 forks source link

Do not use BuildContexts across async gaps. #24

Closed dv30fps closed 12 months ago

dv30fps commented 1 year ago

fts generates a file .dart_tool/flutter_gen/gen_l10n/app_localizations.dart with the definition of abstract class AppLocalizations. I am using this class as documented:

final AppLocalizations l10n = AppLocalizations.of( context )!;

I also use the lint 2.0.1 package, which flags the statement above with the message:

Do not use BuildContexts across async gaps. https://dart-lang.github.io/linter/lints/use_build_context_synchronously.html

Why does fts generate app_localizations.dart with the line "import 'dart:async';"? It does not appear to use async/await. This may be the trigger for the warning above.

IsmailAlamKhan commented 1 year ago

@dv30fps fts doesn't generate this, the official flutter package generates that file

dv30fps commented 12 months ago

The generated file .dart_tool/flutter_gen/gen_l10n/app_localizations.dart is not the cause of the lint warning.