mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 05:25:19 +00:00
implement inject generator
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user