1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-12 15:58:32 +00:00

navigation_and_routing: a bunch of cleanup (#886)

Fail early on nullable context objects - no code paths allow null
Eliminate superfluous private function
Use a function over an abstract class with one method
This commit is contained in:
Kevin Moore
2021-08-26 16:14:29 -07:00
committed by GitHub
parent ad6dc454f2
commit ecf716dcab
13 changed files with 84 additions and 122 deletions

View File

@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/link.dart';
import '../auth/auth.dart';
import '../auth.dart';
import '../routing.dart';
class SettingsScreen extends StatefulWidget {
@@ -52,7 +52,7 @@ class SettingsContent extends StatelessWidget {
),
ElevatedButton(
onPressed: () {
BookstoreAuthScope.of(context)!.signOut();
BookstoreAuthScope.of(context).signOut();
},
child: const Text('Sign out'),
),
@@ -66,7 +66,7 @@ class SettingsContent extends StatelessWidget {
TextButton(
child: const Text('Go directly to /book/0 (RouteState)'),
onPressed: () {
RouteStateScope.of(context)!.go('/book/0');
RouteStateScope.of(context).go('/book/0');
},
),
].map((w) => Padding(padding: const EdgeInsets.all(8), child: w)),