Today I’m going to introduce you to 3 tips that will take your Flutter development to the next level!
If you like this content, then I would appreciate if you slap the clap button ;)
Let’s get started right away!
Fix all errors
Who doesn’t hate to see this message in VSCode?
(Project from the past)
Often it is imports that are not needed, missing const keywords and much more. But, isn’t there some way to fix these errors in a matter of seconds in the whole project? Yes, there is, and it’s much easier than you think. Just navigate to your project in the terminal and type **dart fix --apply**
. And everything is fixed ;)
Better Error Screen
Everybody, really everybody hates this error screen:
But what if I told you that you can make this screen so much better with a few lines of code? Well, I’m going to show you how to do that:
- in your
main
function, add the following:
2. now you can create your own screen in the material widget. This could look like this:
3. but wait, how did I get the error message into the screen now? Well, quite simply by calling details.exception.toString()
.
That was it. This tip came in cooperation with FlutterMapp in this article.
See all your dependencies
Do you want to know all the dependencies that are in your Flutter project? For this there is a command: flutter pub deps
. Now you get a tree that could look like this:
(This is only a very small part of the complete output).
Further reading
That’s it for this article. BUT WAIT! Before you go now, I can highly recommend this article. It’s 4 flutter tips which are possibly even better than this one. So, what are you waiting for?: https://tomicriedel.medium.com/57686f1e3707
Thanks for reading and don’t forget to follow me!