1
0
mirror of https://github.com/flutter/samples.git synced 2026-05-22 23:18:50 +00:00

Migrate web dashboard to null safety (#928)

* update dependencies

* Update to cloud_firestore 2.x.x

* run dart migrate

* Fix analyzer warnings from null safety migration

* Fix errors resulting from null safety migration

* Fix info level warnings

* run flutter format

* fix tests

* remove unused import, format
This commit is contained in:
John Ryan
2021-10-12 14:38:34 -07:00
committed by GitHub
parent 0061b0d70d
commit 4893a24625
20 changed files with 277 additions and 301 deletions

View File

@@ -10,13 +10,13 @@ import '../app.dart';
import '../widgets/category_chart.dart';
class DashboardPage extends StatelessWidget {
const DashboardPage({Key key}) : super(key: key);
const DashboardPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var appState = Provider.of<AppState>(context);
return FutureBuilder<List<Category>>(
future: appState.api.categories.list(),
future: appState.api!.categories.list(),
builder: (context, futureSnapshot) {
if (!futureSnapshot.hasData) {
return const Center(
@@ -25,7 +25,7 @@ class DashboardPage extends StatelessWidget {
}
return StreamBuilder<List<Category>>(
initialData: futureSnapshot.data,
stream: appState.api.categories.subscribe(),
stream: appState.api!.categories.subscribe(),
builder: (context, snapshot) {
if (snapshot.data == null) {
return const Center(
@@ -41,9 +41,9 @@ class DashboardPage extends StatelessWidget {
}
class Dashboard extends StatelessWidget {
final List<Category> categories;
final List<Category>? categories;
const Dashboard(this.categories, {Key key}) : super(key: key);
const Dashboard(this.categories, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -55,7 +55,7 @@ class Dashboard extends StatelessWidget {
maxCrossAxisExtent: 500,
),
children: [
...categories.map(
...categories!.map(
(category) => Card(
child: CategoryChart(
category: category,