Skip to content

albertmiro/bloc-architecture-flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example BLoC Architecture

Example project to explore the BLoC architecture and learn Flutter/Dart

What's about?

The aim of this project is to learn Flutter and BLoC architecture, as well as keeping things simple, secure while using good software development practices.

What I should know

If you want to clone this project and try it out, you should follow the next steps:

API KEY

Create an assets folder juts in the root of this project, and inside it, you would need to store the secrets.json file.

The IMDB API Key could be obtained from this link

secrets.json:

{
  "api_key": "YOUR_API_KEY"
}

How to generate the automatic JSON parsing code?

If the files inside models/ folder are changed, we would need to run:

$ flutter packages pub run build_runner watch

In order to automatically generate the .g files, that would contain the necessary code for JSON parsing given a model.

What's done & left to do?

  • BLoC (Business Logic Component) architecture
  • JSON Serialization
  • Load a list retrieved from a web service
  • Hide Secret API Key
  • Business models & Data models
  • Mapper between models
  • Open detail when clicking on an item
  • Unit tests
  • Widget tests
  • Code coverage report
  • Check that code style is following most of Dart/Flutter specs

Current dependencies added at pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  rxdart: ^0.18.0
  http: ^0.12.0+1
  json_annotation: ^2.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.0.0
  json_serializable: ^2.0.0

Resources used:

In order to work with this project I will be following and merging these different articles: