Skip to content

Commit 89a2853

Browse files
committed
feat: update performance to latest versions
1 parent 967bea4 commit 89a2853

File tree

5 files changed

+25
-137
lines changed

5 files changed

+25
-137
lines changed

performance/lib/firebase_options.dart

Lines changed: 0 additions & 96 deletions
This file was deleted.

performance/lib/main.dart

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import 'package:firebase_core/firebase_core.dart';
2020
import 'package:firebase_performance/firebase_performance.dart';
2121
import 'package:flutter/material.dart';
2222
import 'package:performance_quickstart/firebase_status.dart';
23-
import 'package:provider/provider.dart';
2423
import 'package:http/http.dart' as http;
2524
import 'package:url_launcher/url_launcher.dart';
2625

@@ -29,14 +28,13 @@ import './firebase_options.dart';
2928
void main() {
3029
WidgetsFlutterBinding.ensureInitialized();
3130

32-
runApp(ChangeNotifierProvider(
33-
create: (context) => ApplicationState(),
34-
builder: (context, child) => const MyApp(),
35-
));
31+
runApp(MyApp(state: ApplicationState()));
3632
}
3733

3834
class MyApp extends StatelessWidget {
39-
const MyApp({super.key});
35+
const MyApp({super.key, required this.state});
36+
37+
final ApplicationState state;
4038

4139
// This widget is the root of your application.
4240
@override
@@ -55,15 +53,16 @@ class MyApp extends StatelessWidget {
5553
// is not restarted.
5654
primarySwatch: Colors.blue,
5755
),
58-
home: const MyHomePage(title: 'Firebase Performance Monitoring'),
56+
home: MyHomePage(title: 'Firebase Performance Monitoring', state: state),
5957
);
6058
}
6159
}
6260

6361
class MyHomePage extends StatelessWidget {
64-
const MyHomePage({super.key, required this.title});
62+
const MyHomePage({super.key, required this.title, required this.state});
6563

6664
final String title;
65+
final ApplicationState state;
6766

6867
@override
6968
Widget build(BuildContext context) {
@@ -72,27 +71,29 @@ class MyHomePage extends StatelessWidget {
7271
title: Text(title),
7372
),
7473
body: Center(
75-
child: Consumer<ApplicationState>(
76-
builder: (context, appState, _) => Column(
74+
child: ListenableBuilder
75+
(
76+
listenable: state,
77+
builder: (context, child) => Column(
7778
children: <Widget>[
7879
const Image(
7980
image:
8081
AssetImage('assets/perfmon_horizonal_lockup_light.png')),
8182
const Text('We are using Performance monitoring to monitor a '
8283
'function that gets a random string.'),
8384
ElevatedButton(
84-
onPressed: () => {appState.updateRandomString()},
85+
onPressed: () => {state.updateRandomString()},
8586
child: const Text('Get Random String'),
8687
),
87-
Text(appState.randomString),
88+
Text(state.randomString),
8889
ElevatedButton(
89-
onPressed: () => {appState.getFirebaseStatus()},
90+
onPressed: () => {state.getFirebaseStatus()},
9091
child: const Text('Get Firebase Status'),
9192
),
9293
InkWell(
93-
child: Text(appState.lastIncident),
94-
onTap: () => appState
95-
._launchInWebViewOrVC(Uri.parse(appState.lastIncidentUri)),
94+
child: Text(state.lastIncident),
95+
onTap: () => state
96+
._launchInWebViewOrVC(Uri.parse(state.lastIncidentUri)),
9697
)
9798
],
9899
),

performance/pubspec.lock

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ packages:
140140
dependency: "direct main"
141141
description:
142142
name: http
143-
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
143+
sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139
144144
url: "https://pub.dev"
145145
source: hosted
146-
version: "0.13.6"
146+
version: "1.1.2"
147147
http_parser:
148148
dependency: transitive
149149
description:
@@ -192,14 +192,6 @@ packages:
192192
url: "https://pub.dev"
193193
source: hosted
194194
version: "1.10.0"
195-
nested:
196-
dependency: transitive
197-
description:
198-
name: nested
199-
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
200-
url: "https://pub.dev"
201-
source: hosted
202-
version: "1.0.0"
203195
path:
204196
dependency: transitive
205197
description:
@@ -216,14 +208,6 @@ packages:
216208
url: "https://pub.dev"
217209
source: hosted
218210
version: "2.1.7"
219-
provider:
220-
dependency: "direct main"
221-
description:
222-
name: provider
223-
sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096"
224-
url: "https://pub.dev"
225-
source: hosted
226-
version: "6.1.1"
227211
sky_engine:
228212
dependency: transitive
229213
description: flutter

performance/pubspec.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ dependencies:
4949

5050
# The following adds the Cupertino Icons font to your application.
5151
# Use with the CupertinoIcons class for iOS style icons.
52-
cupertino_icons: ^1.0.2
53-
firebase_core: ^2.3.0
54-
provider: ^6.0.4
55-
firebase_performance: ^0.9.0+6
56-
http: ^0.13.5
57-
url_launcher: ^6.1.7
52+
cupertino_icons: ^1.0.6
53+
firebase_core: ^2.24.2
54+
firebase_performance: ^0.9.3+8
55+
http: ^1.1.2
56+
url_launcher: ^6.2.2
5857

5958
dev_dependencies:
6059
flutter_test:

performance/test/widget_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import 'package:performance_quickstart/main.dart';
2727
void main() {
2828
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
2929
// Build our app and trigger a frame.
30-
await tester.pumpWidget(const MyApp());
30+
await tester.pumpWidget(MyApp(state: ApplicationState()));
3131

3232
// Verify that our counter starts at 0.
3333
expect(find.text('0'), findsOneWidget);

0 commit comments

Comments
 (0)