Fix Linting warnings on Flutter User Management Starter Tutorial #24877
Labels
documentation
Improvements or additions to documentation
pr-opened
A PR has been opened to resolve the issue
Improve documentation
Link
https://supabase.com/docs/guides/getting-started/tutorials/with-flutter
Describe the problem
The placeholder main.dart is incomplete and might be a little misleading before finishing the tutorial.
There are a couple lint warnings when going through the tutorial which are not an issue to compile and run but seeing those warnings might confuse and mislead people going through it.
Lint warning 1 - Invalid use of a private type in a public API. Try making the private type public, or making the API that uses the private type also be private.
Lint warning 2 - Don't use 'BuildContext's across async gaps. Try rewriting the code to not use the 'BuildContext', or guard the use with a 'mounted' check.
Describe the improvement
For the main.dart, Add a stub for MyApp Class and add the imports just to fill out the placeholder class to now throw any errors while going through the tutorial.
For warning 1, this change was made for all the pages with similar initializations:
_SplashPageState createState() => _SplashPageState();
Change to
State<SplashPage> createState() => _SplashPageState();
For warning 2, adding a if (mounted) {} check on the exception handling
Additional context
This shouldn't change the tutorial fundamentally in anyway. Just wanted to remove the linting warnings and fill out the the initial main function to not throw any erorrs while going through the tutorial.
The text was updated successfully, but these errors were encountered: