App for show comics
This app makes a pair of request to the comic’s api ComicVine https://comicvine.gamespot.com/api/
This app uses only Flutter Web (version of the sdk: 3.0.1)
Architecture of the app
The app was made following the CLEAN architecture. I did the project thinking not only in this particular functionality but on the hypothetical future were the app grows and need to have more things in it.
But, It dont have certain things that I know it is best practices:
- Setting literal strings in a file for futures languages
- Setting custom theme
- totally lack of unit testing
Little explanation of the app architecture:
Data: the layer where are all the data sources of the app, in this case, we only have one module thats is the data source of comics
Domain: the layer for make all the bussiness things, in this case, we only have one module, thats is the bussiness logic of get the comics
Presentation: Here we have just the presentation of the data and its states, in this case, we have: comics (the comics list, basically, the main menu) and comics_list were is shown the details of a selected comic
IMPORTANT: before test
( Please, do it too in order to make the app functional).
A) I was struggle with a CORS problem trying to get the data from the api, so the workaround that I encountered was to do the following:
- Go to your flutter\bin\cache and remove a file named: flutter_tools.stamp - Go to flutter\packages\flutter_tools\lib\src\web and open the file chrome.dart - Find '--disable-extensions' - Add '--disable-web-security'
Then, the app should do the requests normally.
B) For show some good practices, I write the api URL in a .env file, so please, create a .env file in assets/ and put the base url like this:
API_URL = https://comicvine.gamespot.com/api
Then, put an additional run args when you run the project or config it in android studio as additional run args:
C) The app uses Injectable package in order to show knowledges in DI, so please before start the app run the following:
flutter packages pub run build_runner build