mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
feat: implement InjectGenerator
This commit is contained in:
@@ -11,14 +11,22 @@ part 'app.inject.cherrypick.g.dart';
|
||||
|
||||
@injectable()
|
||||
class MyApp extends StatelessWidget with _$MyApp {
|
||||
final Scope scope;
|
||||
final _appRouter = AppRouter();
|
||||
|
||||
@scope('authZone')
|
||||
@inject()
|
||||
late final String text;
|
||||
|
||||
@scope('authZone')
|
||||
@named('timeout')
|
||||
@inject()
|
||||
late final int timeout;
|
||||
|
||||
@named('repo')
|
||||
@inject()
|
||||
late final PostRepository repository;
|
||||
|
||||
MyApp({super.key, required this.scope});
|
||||
MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -4,8 +4,6 @@ import 'package:postly/app.dart';
|
||||
import 'di/app_module.dart';
|
||||
|
||||
void main() {
|
||||
final scope = CherryPick.openRootScope();
|
||||
scope.installModules([$AppModule()]);
|
||||
|
||||
runApp(MyApp(scope: scope));
|
||||
CherryPick.openRootScope().installModules([$AppModule()]);
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user