A test project for barkibu based on the following requirements: https://public.3.basecamp.com/p/NjeXKfVTEg1jNb5mkzEgDtM3
I used this API https://cataas.com/ for demo purposes.
To test this project you need to implement test backend environment. I decided that fastest way to do it you can use AWS Lambda and API Gateway.
AWS account with access to Lambda and API Gateway services. Installed Flutter SDK.
- If you want to test it with ready backend you can miss steps 1-5.
- Create new Lambda function with any name you want.
- Copy content of backend/lambda_function.py to your lambda function or copy from here:
import urllib3
import json
def lambda_handler(event, context):
http = urllib3.PoolManager()
cats = http.request('GET', 'https://cataas.com/api/cats?tags=cute&limit=10')
if cats.status == 200:
return {
'statusCode': 200,
'body': json.loads(cats.data.decode('utf-8'))
}
else:
return {
'statusCode': 400,
'body': 'Unknown error of API'
}- Create new API Gateway with any name you want.
- Create new GET method for your API Gateway.
- Deploy your API Gateway and test it with Lambda function.
- Copy Function URL from your Lambda function and paste it to your file /lib/repositories/cat_repository.dart to the variable endpoint on line 6.
- Copy this repo to your local machine.
- Run
flutter pub getto install all dependencies. - Run
flutter testto test the project with unit and widget tests. - Run
flutter runto run the project on your device or emulator or usr IDE to run it.