You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
samples/experimental/null_safety/null_safe_app/lib/badapp.dart

37 lines
1.1 KiB

// Copyright 2020, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'services.dart';
// This app doesn't work correctly when the services return null. Try to
// uncomment the for-loop and appBar lines below, and note how the new null
// safety static analysis immediately flags those lines as errors.
class BadMyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final localizedAppName = Config.getAppName();
final temperatures = WeatherService.getTemperatures();
var tempWidgets = [
Text('Temperature next 3 days:'),
// for (final t in temperatures) Text(t.round().toString()),
];
return MaterialApp(
home: Scaffold(
// appBar: AppBar(title: Text(localizedAppName)),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: tempWidgets,
),
),
),
);
}
}