Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

writing prompts

writing prompts application designed to showcase an approach to a “clean”er architecture in flutter with bloc and rxdart, including unit, widget and integration testing.

project overview

writing-prompt

this app fetches data from https://ineedaprompt.com api and displays it on screen. the user can then ask for a new prompt, or see a history of prompts.

project structure

the project is structured as follows:

|_data
 __local
 __remote
|_domain
 __bloc
 __managers
 __mappers
 __models
|_presentation
 __styles
 __ui
 __utils
 main.dart

data

the data stores both the api and local database information that will be displayed in the app.
all the api endpoints, models, serialized classes and database helpers should be put here.

domain

this layer connects the data layer to the presentation, preparing the information received from the local database or the server and managing the app state (i.e., if we need to fetch new data, fetch new data)

to communicate with the widgets, we use the bloc architecture and streambuilders.

presentation

since flutter does not have a resources folder as we see in android, we need to declare each resource on a file. as such, i created the styles (naming to be changed) folder which include information about colors, strings and dimensions used in the app.

here we have all the widgets of the app, and their connection to the domain layer via the bloc.

main.dart

since i chose not to use a dependency injection framework, this is where i create all the classes to be used in the app, inherited by each widget.

testing

though the app is not fully tested, i strived to show how to:

  • write unit tests that test a small module (in this case method) of a class. they tested the network layer and domain layer
  • widget tests that assure that the bloc is providing the correct information to the widgets
  • integration test that test a normal app use, expecting a new prompt to be shown on screen.

to-do list

  • [ ] create more app animations
  • [ ] include more app features, such as share
  • [ ] create more tests

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.