dan12411 / BestArchitectureChallenge

此為參加 Flutter Best Architecture Challenge 活動的專案

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dart CI

🐶🐨🦁 Flutter Best Architecture Challenge 🦁🐨🐶

此為參加 Flutter Best Architecture Challenge 活動的專案

Architecture

  • Reso Coder's Flutter Clean Architecture Proposal, reference: TDD Clean Architecture

  • Separate into 3 layers:

    1. Presentation Layer
      • FetchPostsBloc, FetchPostsEvent, FetchPostsState - Handles basic input conversion and validation.
      • PostPage
      • PostView
    2. Doamin Layer
      • FetchPost - Use case, handle business logic.
      • FetchPostRepository - Interface between domain and data layer.
      • Post,SortBy - Entities.
    3. Data Layer
      • FetchPostRepositoryImpl - Implementation of repository
      • PostModel - Model extends entities, knowing infrastructure detail.
      • FetchPostDataRemoteDataSource,FetchPostDataRemoteDataSourceImpl - Interface & implementation of remote data source
  • Graph:

3rd Party Libraries

  • get_it - Setting up a service locator, for injecting dependencies
  • flutter_bloc - For BLoC design pattern
  • equatable - For value based equality
  • dartz - For some functional programming tools
  • bloc_test - Easy to test blocs
  • mockito - APIs for Fakes, Mocks..etc
  • build_runner - For for Dart code generation
  • http - Future-based API for HTTP requests

Unit Tests

  • Use case tests: test fetch data when failure/empty/success (sorted by id/title).
  • Repository tests: test fetch data when failure/empty/success.
  • Remote data source tests: test fetch data when http status code is 200/404.
  • Bloc tests: test initial state, load data state when failure/success.

Preview

preivew

Environment

Flutter 2.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 02c026b03c (5 weeks ago) • 2021-05-27 12:24:44 -0700
Engine • revision 0fdb562ac8
Tools • Dart 2.13.1

Contact Information

About

此為參加 Flutter Best Architecture Challenge 活動的專案


Languages

Language:Dart 95.8%Language:Swift 3.6%Language:Kotlin 0.5%Language:Objective-C 0.1%