Power Up Your Flutter Development Process by Implementing Clean Architecture and Test-Driven Development | by Aditya Rohman | Feb, 2022

lib
├── knowledge
│ ├── constants.dart
│ ├── datasources
│ │ └── remote_data_source.dart
│ ├── exception.dart
│ ├── failure.dart
│ ├── fashions
│ │ └── weather_model.dart
│ └── repositories
│ └── weather_repository_impl.dart
├── area
│ ├── entities
│ │ └── climate.dart
│ ├── repositories
│ │ └── weather_repository.dart
│ └── usecases
│ └── get_current_weather.dart
├── injection.dart
├── foremost.dart
└── presentation
├── bloc
│ ├── weather_bloc.dart
│ ├── weather_event.dart
│ └── weather_state.dart
└── pages
└── weather_page.dart
check
├── knowledge
│ ├── datasources
│ │ └── remote_data_source_test.dart
│ ├── fashions
│ │ └── weather_model_test.dart
│ └── repositories
│ └── weather_repository_impl_test.dart
├── area
│ └── usecases
│ └── get_current_weather_test.dart
├── helpers
│ ├── dummy_data
│ │ └── dummy_weather_response.json
│ ├── json_reader.dart
│ ├── test_helper.dart
│ └── test_helper.mocks.dart
└── presentation
├── bloc
│ └── weather_bloc_test.dart
└── pages
└── weather_page_test.dart

Step — 1: Writing code on the area layer

Usecases

flutter pub run build_runner construct
Get present climate use case check end result

Step — 2: Writing code on the info layer

Fashions

Mannequin testing end result

Information Sources

Pattern JSON response
Information sources testing end result

Repositories

flutter pub run build_runner construct
Repository testing end result

Step — 3: Writing code on the presentation layer

State administration (BLoC)

flutter pub run build_runner construct
BLoC state administration testing end result

Pages

Web page testing end result
Ultimate end result
flutter check --coverage
genhtml protection/lcov.information -o protection/html
open protection/html/index.html
Take a look at protection end result

More Posts