implement inject generator

This commit is contained in:
Sergey Penkovsky
2025-05-23 15:26:09 +03:00
parent 9c42ba4cef
commit 8438697107
5 changed files with 32 additions and 16 deletions

View File

@@ -13,24 +13,16 @@ part 'app.inject.cherrypick.g.dart';
class MyApp extends StatelessWidget with _$MyApp {
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});
MyApp({super.key}) {
_inject(this);
}
@override
Widget build(BuildContext context) {
_inject(this);
return BlocProvider(
create: (_) => PostBloc(repository),
child: MaterialApp.router(