Skip to content

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

Notifications You must be signed in to change notification settings

dan12411/BestArchitectureChallenge

 
 

Repository files navigation

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 活動的專案

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 95.8%
  • Swift 3.6%
  • Other 0.6%