Fakultas Ilmu Komputer UI

Commit 32fa51e1 authored by Fakhira Devina's avatar Fakhira Devina
Browse files

[CHORE] Update readme

- add section for building models
- add  section for BLoC
parent 23b1867f
Pipeline #37263 failed with stages
in 3 minutes and 18 seconds
......@@ -50,4 +50,17 @@ MAPS_API_KEY=Bu***************
Run the app using the development flavor
```bash
flutter run -t lib/main_dev.dart
```
\ No newline at end of file
```
## Building Models with JsonSerializable
Jadi abis get dari API, jsonnya di map ke models biar rapih.
1. Tulis ada field apa aja dari jsonnya (bisa liat contoh yang di models/lokasi.dart)
2. bagian 'part of {nama models}.g.dart' itu harus ditulis di model yg mau dibuat. di awal emang merah, tapi biarin aja
3. kalo semua field udah di tulis, run
```bash
flutter pub run build_runner build
```
4. nanti akan ke build file {nama models}.g.dart, yang di nomor 2 merah harusnya udah gak merah lagi
## Passing Data with BLoC
Udah ada contohnya di /bloc (implementasi di screen nya ada di page/pencarian/pencarian.dart)
Bisa baca [disini]https://itnext.io/flutter-handling-your-network-api-calls-like-a-boss-936eef296547 sebagai panduannya
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment