Flutter is Google's UI toolkit for building beautiful, natively compiled applications from a single codebase. It allows creating mobile, web, and desktop apps. The document provides an overview of getting started with Flutter and common widgets like text, buttons, lists, and more. It also describes data management using Moor and shared preferences as well as connecting to REST APIs with packages like Retrofit and Dio.
2. Who am I?
● Former
○ Product manager @ Trilex Network
○ Software Engineer @ Software Industry Promotion Agency
○ Team Leader @ Digital Park Thailand
○ Team Leader @ IoT and Digital Innovation Institute, DEPA
○ Content creator @ Thaiopensource.org
● Present
○ A cat slave
○ A Traveler in Teyvat
3.
4.
5.
6. Flutter is Google’s UI toolkit for building
beautiful, natively compiled applications for
mobile, web, and desktop from a single
codebase.
153. Shared Preferences
● Add plugin shared_preferences to your project
● Use shared preference to store key-value data
Shared Preference - https://pub.dev/packages/shared_preferences
154. Workshop 7
● Write profile page
● Save username and avatar path to shared preferences
23_sharedpreferences
158. REST API
Http request method GET, PUT, POST, DELETE to perform action to your resource.
http://127.0.0.1/api/v1/user
159. REST API
GET PUT POST DELETE
/user Get all user Add new user Add new user Delete all user
/user/1 Get user
Id = 1
Update user
Id = 1
Delete user
id = 1
Request methods
160. REST API
Sample http status code
● 200 Ok
● 201 Created
● 400 Bad request
● 401 Unauthorized
● 403 Forbidden
● 404 Not found
REST API Status code - https://restfulapi.net/http-status-codes
162. http
● Add http plugin to your pubspec.yaml
● Test your endpoint eg: Swagger, Postman, Insomnia etc
● Write a service call according to your request
● Merge your request to widget in Flutter
Cookbook Networking -> https://flutter.dev/docs/cookbook#networking
165. Retrofit
3. Create rest client and model class
1. RestClient
2. Model
Use build_runner to generate code
flutter packages pub run build_runner build
Call REST API with RestClient