I have had a productive week. Thanks to MTECHVIRAL‘s Flutter series I am making a swift progress in learning the mobile and desktop hybrid programming language.
I find Dart to be super close to Java with a lot less boilerplate code but I still find Kotlin to be my favorite programming language. Although learning Flutter would mean that I could write mobile, web and desktop apps all together which would be a big win for me. Although Kotlin can also do that but it seems like Kotlin being a JVM language brings a bit of cruft with it.
I saw use of
new keyword and also a semicolon to end a statement in Dart but I am glad to know that Dart 2.0 has made
new keyword optional whereas semicolon is still required to end a statement.
Dart is very similar to Java and most Java developers will have no issues learning it. In fact it could be picked up in a weekend.
In Flutter like in Android where main container is an Activity and anything drawn on the screen is a
View similarly in Flutter everything is a
Widget. My understanding is that in order to create Material design apps we have to start with a
MaterialApp object. Inside a
MaterialApp object resides an object that provides the structure to start drawing widgets on. This structure is known as a
Scaffold. Within the
MaterialApp package will provide you button, text fields, etc. which are similar to what we have in Android.
Another main Flutter concept to understand is the concept of a
State. There are two types of widgets in Flutter. Flutter widgets are of two types which as stateful and stateless. Anything that you can interact with and if this interaction changes the state of the widget then the Widget is said to be a
Stateful Widget. For example, a Checkbox comes with two states checked and unchecked and you probably want to use a Stateful widget if you want your users to be able to change the state from checked to unchecked or vice versa. The second type of widgets are
Stateless Widgets. Any widget which doesn’t change its state or remains the same throughout the life cycle of the app would be a Stateless widget.