null safety
This commit is contained in:
@@ -6,10 +6,10 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CargoTable extends StatefulWidget {
|
||||
final List<CargoType> cargoTypes;
|
||||
final List<CargoType>? cargoTypes;
|
||||
|
||||
const CargoTable({
|
||||
Key key,
|
||||
Key? key,
|
||||
this.cargoTypes,
|
||||
}) : super(key: key);
|
||||
|
||||
@@ -58,13 +58,13 @@ class _CargoTableState extends State<CargoTable> {
|
||||
return [];
|
||||
}
|
||||
double total = 0;
|
||||
var rows = widget.cargoTypes.map((c) {
|
||||
total += c.weight;
|
||||
var rows = widget.cargoTypes!.map((c) {
|
||||
total += c.weight!;
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) async {},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
c.name == null ? "" : c.name,
|
||||
c.name ?? "",
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(c.qty == null || c.qty == 0
|
||||
@@ -81,7 +81,7 @@ class _CargoTableState extends State<CargoTable> {
|
||||
),
|
||||
)),
|
||||
MyDataCell(
|
||||
Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2),
|
||||
Text(c.weight == null ? "0" : c.weight!.toStringAsFixed(2),
|
||||
style: textStyle),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user