Used Provider-Package to encapsulate state management
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'pages/flood_station_page.dart';
|
||||
import 'pages/landing_page.dart';
|
||||
import 'services/flood_station_provider.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
runApp(
|
||||
ChangeNotifierProvider(
|
||||
create: (context) => FloodStationProvider(),
|
||||
child: const MyApp(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@@ -20,6 +28,7 @@ class MyApp extends StatelessWidget {
|
||||
initialRoute: LandingPage.routeName,
|
||||
routes: {
|
||||
LandingPage.routeName: (context) => LandingPage(),
|
||||
FloodStationPage.routeName: (context) => FloodStationPage(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user