A little about Flutter at beginner level

Table of contents

No heading

No headings in the article.

Here are some tips to make it easier using flutter as a beginner:

  1. You can have a stateful or a stateless widget , if you need to have changes on the screen, then it's stateful, but if nothing changes , it's stateless.
  2. A stateful widget has two parts , the widget and the state . The widget can be used to get access to data from a different screen and get it into it's state while the state part deals with what can change and might need updating in your app.
  3. If you need a code to operate automatically a screen is displayed without the press of anything, put it in the initstate() method, that will do the trick.
  4. Packages exist to make life easy for us, you don't need to do what someone else has done , just get their codes and work with them .
  5. Try to read documentation , it helps you grasp how a package or widget works, it saves you time rather than heading in the wrong direction.
  6. Any variable declared in a function is local to that function, to let other functions have access to it, declare it in the state(for stateful widgets) or in the widget( for stateless widgets), then assign to it the value from your function.
  7. If you are using asynchronous programming, and your method/function returns an object , the function should be named with the type FUTURE , as it is a FUTURE object but if it returns nothing then make it a void.
  8. Always name functions, classes with unambiguous names , names that will make the function of the function clear even before reading the code , it improves code readability.
  9. Constants should have a separate File , as this will help where there is a need to make changes , you'll only need to make the changes in that file and they will be updated in every other part.
  10. Use the async await where you are listening for events that have no specific time of execution , or where the code does not run instantly but requires some data to run, and label the return type as a FUTURE.
  11. Don't make your app boring , you can add an animation where there is a delay while you're expecting the result of an asynchronous programming.