Compare commits

...

2 Commits

Author SHA1 Message Date
d44fc9a75c Merge remote-tracking branch 'origin/myRequest' into myRequest 2024-07-17 10:17:36 +03:30
e846da176b Some lang fixes. 2024-07-17 10:17:25 +03:30
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@ void main() {
// For widgets to be able to read providers, we need to wrap the entire
// application in a "ProviderScope" widget.
// This is where the state of our providers will be stored.
ProviderScope(
const ProviderScope(
child: MyApp(),
),
);
@ -26,6 +26,8 @@ void main() {
// Extend ConsumerWidget instead of StatelessWidget, which is exposed by Riverpod
class MyApp extends ConsumerWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final String value = ref.watch(helloWorldProvider);
@ -36,9 +38,9 @@ class MyApp extends ConsumerWidget {
body: Center(
child: Column(
children: <Widget>[
Expanded(child: Text('1')),
const Expanded(child: Text('1')),
Expanded(child: Text(value)),
Expanded(child: RandomWidget())
const Expanded(child: RandomWidget())
],
)

View File

@ -2,7 +2,6 @@
// GET http://localhost:3000/p/random
import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:riverpod_annotation/riverpod_annotation.dart';
import '../model/my_random.dart';

View File

@ -19,7 +19,7 @@ class RandomWidget extends StatelessWidget {
return Center(
child: switch (myRandom) {
AsyncData(:final MyRandom value ) => Text(
'myRandom: ${value}'
'myRandom: $value'
),
AsyncError() => const Text('Oops, something unexpected happened'),
_ => const CircularProgressIndicator(),