mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 05:25:19 +00:00
implement example
This commit is contained in:
21
examples/client_app/lib/my_home_page.dart
Normal file
21
examples/client_app/lib/my_home_page.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cherrypick_flutter/cherrypick_flutter.dart';
|
||||
import 'use_case.dart';
|
||||
|
||||
class MyHomePage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Разрешение зависимости UseCase из рутового скоупа
|
||||
final UseCase useCase =
|
||||
CherryPickProvider.of(context).openRootScope().resolve<UseCase>();
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Example App'),
|
||||
),
|
||||
body: Center(
|
||||
child: Text(useCase.fetchData()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user