a flutter-application for managing provisions
disable null safety
flutter run --no-sound-null-safety
nix
.dir-locals.el
.envrc
shell.nix
flutter create --project-name staples .
https://www.youtube.com/channel/UCT-_RvXQ3TxFIoDT-WrnJLw/videos
flutter pub add -d bdd_widget_test
flutter pub add -d build_runner
flutter pub add -d golden_toolkit
When I enter {'EAN-13'} text into {0} text field
will result in
i_enter_text_into_text_field.dart
import 'package:flutter_test/flutter_test.dart'; Future<void> iEnterTextIntoTextField(WidgetTester tester, dynamic param1, dynamic param2) async { throw UnimplementedError(); }success
When I enter {'EAN-13'} into {0} input field
^ ^^^
will result in
i_enter_into_input_field.dart
import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; /// Example: When I enter {'text'} into {1} input field Future<void> iEnterIntoInputField( WidgetTester tester, String text, int index, ) async { final textField = find.byType(TextField).at(index); await tester.enterText(textField, text); }
~/.pub-cache/hosted/pub.dartlang.org/bdd_widget_test-1.2.1/lib/step/i_enter_into_input_field.dart
flutter pub run build_runner build
flutter pub run build_runner build test
flutter pub run build_runner watch --delete-conflicting-outputs
https://docs.flutter.dev/cookbook/testing/unit/mocking#3-create-a-test-file-with-a-mock-httpclient
flutter pub add -d mockito
https://pub.dev/packages/mockito
https://medium.com/flutter-community/flutter-golden-tests-compare-widgets-with-snapshots-27f83f266cea https://pub.dev/packages/golden_toolkit
flutter test --update-goldens
flutter test --update-goldens --tags=golden
flutter test --update-goldens <PATH_TO_TEST_FILE>
https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
https://resocoder.com/flutter-clean-architecture-tdd/
https://devmuaz.medium.com/flutter-clean-architecture-series-part-1-d2d4c2e75c47 https://devmuaz.medium.com/flutter-clean-architecture-series-part-2-bcdf9d38fe41 https://devmuaz.medium.com/flutter-clean-architecture-series-part-3-cdfbcb8d449b https://github.com/devmuaz/flutter_clean_architecture/tree/part1_setup
https://herbertograca.com/2019/06/05/reflecting-architecture-and-domain-in-code/
A Flutter BLoC + Clean Architecture journey to release the #1st Idean Flutter app | by Etienne Cadic | Ideas by Idean | Medium
at projectRoot
:
lib
presentation layer: All the UI stuff, widgets and design utils
data
layer: All the input data stuff (from async sources)
core
useful to share code between layers
domain
layer: the business layer, manipulating pure entities through usecases.
in lib
and test
mkdir -p config/{routes,themes} \ core/utils \ data/{datasources/{local,remote},models,repositories} \ domain/{entities,repositories,usecases} \ presentation/{bloc,views,widgets}
mkdir -p config core data/{datasources/{local,remote},models,repositories} domain/{entities,repositories,usecases} presentation/{bloc,views,widgets}
flutter pub add get_it
- State “TODO” from [2021-11-29 Mon 18:31]
flutter pub add injectable
flutter pub add -d injectable_generator
flutter pub add flutter_bloc
flutter pub add equatable
Dart Equatable Package: Simplify Equality Comparisons | by Felix Angelov | Flutter Community | Medium
flutter pub add dartz
flutter pub add data_connection_checker
flutter pub add http
flutter pub add shared_preferences
Navigator1.0 examples not working - use Navigator2.0 instead
https://bloclibrary.dev/#/recipesflutternavigation?id=navigation-20
flutter pub add flow_builder
https://verygood.ventures/blog/navigator-with-flow-builder
https://en.wikipedia.org/wiki/International_Article_Number
GTIN GlobalTradeItemNumber. GTIN is the series of numbers associated with a barcode. GTIN codes are part of larger global data structures that help identify a company’s unique product. UPC, EAN, and ISBN are all GTINs. GTIN is the number encoded into either a UPC, EAN, or ISBN barcode.https://pub.dev/packages/test#tagging-tests because bdd-Tests are generated, they cannot be tagged. Tag unit tests instead
The annotation ‘Tags’ can only be used on libraries (lsp)
@Tags(['unit', 'FEATURE-NAME'])
flutter test -t unit products
test('should ...', () async { when() .thenAnswer(); // act final result = await actor() // assert expect(); verify(); verifyNoMoreInteractions(); }, tags: ['unit', 'product']);
flutter test -t unit,product flutter test -t "(unit) && !(product)"test/configuration.md at master · dart-lang/test
- State “TODO” from [2021-12-01 Wed 18:26]
the main dataProvider will be ecoinform.de roughly base the entity on the provided data
class Item extends Product {
//...
final Date bb; // BestBefore(End)
final int _priceInCent;
double get price(int priceInCent) => double(priceInCent/100);
int set _priceInCent(num price) => price is int ? price : price * 100;
//...
}
- import mockito
import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart';
- annotate
@GenerateMocks([ProductRepository])
- generate mocks
flutter pub run build_runner build
- import generated mocks
import 'getAllProducts_test.mocks.dart'
- use
DataAccessObject
https://pub.dev/packages/floor
flutter pub add floor
flutter pub add sqflite
flutter pub add floor_generator -d
https://github.com/google/app-resource-bundle
https://localizely.com/flutter-arb/
https://medium.com/ideas-by-idean/flutter-test-reports-in-cis-current-state-of-art-8968b0c8dd4a
https://pub.dev/packages/floor
https://pub.dev/packages/retrofit
https://pub.dev/packages/flutter_hooks
where??
sourceOfTruth for
would you like to send or fetch data diffing??
https://herbertograca.com/2017/07/03/the-software-architecture-chronicles/
hgraca/explicit-architecture-php: This repository is a demo of Explicit Architecture, using the Symfony Demo Application.
https://github.com/hgraca/explicit-architecture-php
start by defining a BDD-Feature
NAME_test.dart
@GenerateMocks([http.Client])
TDD
TDD
TDD
https://api.flutter.dev/flutter/widgets/Placeholder-class.html
BDD
BDD