-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathmain.dart
More file actions
30 lines (27 loc) · 952 Bytes
/
main.dart
File metadata and controls
30 lines (27 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter_testing_tutorial/news_change_notifier.dart';
import 'package:flutter_testing_tutorial/news_page.dart';
import 'package:flutter_testing_tutorial/news_service.dart';
void main() => runApp(MyApp());
/// Root widget of the application
///
/// This stateless widget sets up the basic app structure including:
/// - MaterialApp as the root
/// - Provider for state management
/// - Initial route to NewsPage
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'News App',
// Initialize NewsChangeNotifier with NewsService dependency
home: ChangeNotifierProvider(
create: (_) => NewsChangeNotifier(NewsService()),
child: const NewsPage(),
),
);
}
}