Migrate to null-safety

fixes #1
This commit is contained in:
SimonIT 2021-08-17 13:48:08 +02:00
parent 97570ff2f9
commit 106f2d6bbb
No known key found for this signature in database
GPG key ID: 8D07E7C11D5705EE
7 changed files with 98 additions and 182 deletions

View file

@ -42,11 +42,11 @@ Widget createScaffold() {
children: <Widget>[
CheckboxListTileFormField(
title: Text('Check!'),
onSaved: (bool value) {
onSaved: (bool? value) {
print(value);
},
validator: (bool value) {
if (value) {
validator: (bool? value) {
if (value!) {
return null;
} else {
return 'False!';
@ -57,12 +57,12 @@ Widget createScaffold() {
initialValue: true,
enabled: false,
iconSize: 32,
onSaved: (bool value) {},
onSaved: (bool? value) {},
),
RaisedButton(
onPressed: () {
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
}
},
child: Text('New'),