123456789101112131415161718192021222324252627282930313233 |
- import 'package:flutter/material.dart';
- import 'package:flutter_provider_demo/routes.dart';
- import 'package:provider/provider.dart';
- void main() {
- runApp(const MyApp());
- }
- class MyApp extends StatelessWidget {
- const MyApp({super.key});
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return MultiProvider(
- providers: [
- // Provider<Counter>.value(value: Counter()),
- ChangeNotifierProvider<Counter>(create: (_) => Counter()),
- ChangeNotifierProvider<ThemeModel>(create: (_) => ThemeModel()),
- ],
- child: MaterialApp(
- title: 'Provider Demo',
- debugShowCheckedModeBanner: false,
- theme: ThemeData(
- primarySwatch: Colors.blue,
- visualDensity: VisualDensity.adaptivePlatformDensity,
- ),
- initialRoute: Routes.index,
- onGenerateRoute: Routes.generateRoute,
- ),
- );
- }
- }
|