Widgets
Widgets
MaterialApp is the starting point of your app, it tells Flutter that you are
going to use Material components and follow material design in your app.
Scaffold
Implements the basic Material Design visual layout structure.
Scaffold is used under MaterialApp, it gives you many basic functionalities,
like AppBar, BottomNavigationBar, Drawer, FloatingActionButton etc.
Padding
Padding in Flutter is the space added inside a widget between the content and
the widget's boundary.
Margin
The margin in Flutter is the space added outside a widget's boundary,
creating space around it.
fromJson Method:
The fromJson method is used to create a Dart object from a JSON data
structure (typically a Map). It takes a single argument, which is the JSON data in
the form of a Map or a Map-like structure. This method is usually a factory
constructor and is responsible for parsing the JSON data and constructing an
instance of the class.
Purpose:
To create a Dart object from JSON data.
Typical Implementation:
In the fromJson method, you parse the JSON data and use it to initialize the
fields of the Dart object. The method then returns an instance of the class with
the parsed data.
toJson Method:
The toJson method is used to convert a Dart object into a JSON data
structure, typically a Map. It takes no arguments and returns a Map that represents
the Dart object's data in a JSON-friendly format.
Purpose:
To serialize a Dart object into JSON data.
Typical Implementation:
In the toJson method, you create a Map and populate it with the fields of the
Dart object that you want to include in the JSON representation. Each field is
usually mapped to a key in the Map. Finally, you return this Map.