12345678910111213141516171819202122232425262728293031323334 |
- import 'package:flutter/material.dart';
- import 'package:flutter_provider_demo/provider/car_provider.dart';
- import 'package:flutter_provider_demo/provider/theme_provider.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: [
- ChangeNotifierProvider<CarProvider>(create: (_) => CarProvider()),
- ChangeNotifierProvider<ThemeProvider>(create: (_) => ThemeProvider()),
- ],
- child: MaterialApp(
- title: 'Provider Demo',
- debugShowCheckedModeBanner: false,
- theme: ThemeData(
- primarySwatch: Colors.blue,
- visualDensity: VisualDensity.adaptivePlatformDensity,
- ),
- initialRoute: Routes.index,
- onGenerateRoute: Routes.generateRoute,
- ),
- );
- }
- }
|