Skip to content

Commit 8f55791

Browse files
authored
Dependency injection example for macros (#3015)
This adds a basic Dagger2-like DI framework example, loosely based on this youtube video https://www.youtube.com/watch?v=oK_XtfXPkqw. There are 3 macros, @Injectable (for injectable classes), @provides (for modules, it is how they provide specific implementations), and @component which takes a bunch of modules and uses them to provide the final instances of things. The interesting stuff is in working/macros/example/lib/injectable.dart :).
1 parent fd8d98c commit 8f55791

File tree

10 files changed

+2117
-336
lines changed

10 files changed

+2117
-336
lines changed

analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ analyzer:
55
# TODO: remove these when the analyzer supports macros
66
- working/macros/example/lib/auto_dispose.dart
77
- working/macros/example/lib/data_class.dart
8+
- working/macros/example/lib/injectable.dart
89
- working/macros/example/lib/observable.dart
910
- working/macros/example/lib/json_serializable.dart
1011
- working/macros/example/bin/user_main.dart

0 commit comments

Comments
 (0)