phase3: nullfix.py batch script — bang/late/param-nullable
Automated null-safety fixes driven by dart analyze (no corruption): - unchecked_use_of_nullable_value: insert '!' on receiver (property/method/[]/op) - not_initialized field/var: mark 'late' - missing_default_value_for_parameter: nullable param Errors: 2374(peak) -> 907
This commit is contained in:
@@ -40,14 +40,14 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
S.of(context).radio_option_select_token(product.productAttributes[this.index].name),
|
||||
S.of(context).radio_option_select_token(product.productAttributes![this.index].name),
|
||||
style: new TextStyle(
|
||||
fontSize: 12.5,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
new Text(
|
||||
product.productAttributes[this.index].required ? S.of(context).radio_option_is_required : S.of(context).radio_option_is_optional,
|
||||
product.productAttributes![this.index].required ? S.of(context).radio_option_is_required : S.of(context).radio_option_is_optional,
|
||||
style: new TextStyle(
|
||||
fontSize: 10.0,
|
||||
color: new Color(0xFF999999)
|
||||
@@ -85,14 +85,14 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
'adjust_amount': adjustAmount
|
||||
};
|
||||
var cloneSelections = json.decode(json.encode(selections));
|
||||
if (product.productAttributes[index].required) {
|
||||
cloneSelections[product.productAttributes[index].name.toUpperCase()] = [opt];
|
||||
if (product.productAttributes![index].required) {
|
||||
cloneSelections[product.productAttributes![index].name!.toUpperCase()] = [opt];
|
||||
} else {
|
||||
if (cloneSelections.containsKey(product.productAttributes[index].name.toUpperCase())
|
||||
&& Utils.equalsIgnoreCase(cloneSelections[product.productAttributes[index].name.toUpperCase()][0]['name'], name)) {
|
||||
cloneSelections.remove(product.productAttributes[index].name.toUpperCase());
|
||||
if (cloneSelections.containsKey(product.productAttributes![index].name!.toUpperCase())
|
||||
&& Utils.equalsIgnoreCase(cloneSelections[product.productAttributes![index].name!.toUpperCase()][0]['name'], name)) {
|
||||
cloneSelections.remove(product.productAttributes![index].name!.toUpperCase());
|
||||
} else {
|
||||
cloneSelections[product.productAttributes[index].name.toUpperCase()] = [opt];
|
||||
cloneSelections[product.productAttributes![index].name!.toUpperCase()] = [opt];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
|
||||
if (exclusiveRule != null) {
|
||||
if (_checkOptionIsCheck(productOption.name)) {
|
||||
setOptionsStateDisabled(product.productAttributes[index].name, false);
|
||||
setOptionsStateDisabled(product.productAttributes![index].name, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,14 +118,14 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
children: <Widget>[],
|
||||
);
|
||||
|
||||
List<ProductOption> productOptions = product.productAttributes[index].productOptions;
|
||||
List<ProductOption> productOptions = product.productAttributes![index].productOptions;
|
||||
|
||||
if (!optionsState.containsKey(product.productAttributes[index].name)) {
|
||||
if (!optionsState.containsKey(product.productAttributes![index].name)) {
|
||||
List<Map<String, dynamic>> optionState = [];
|
||||
for (var i = 0; i < productOptions.length; i++) {
|
||||
optionState.add({'name': product.productAttributes[index].productOptions[i].name, 'disabled': false, 'check': false});
|
||||
optionState.add({'name': product.productAttributes![index].productOptions![i].name, 'disabled': false, 'check': false});
|
||||
}
|
||||
optionsState[product.productAttributes[index].name] = optionState;
|
||||
optionsState[product.productAttributes![index].name] = optionState;
|
||||
}
|
||||
|
||||
for (var i = 0; i < productOptions.length; i++) {
|
||||
@@ -135,25 +135,25 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
|
||||
if (exclusiveRule != null) {
|
||||
if (_checkOptionIsCheck(productOptions[i].name)) {
|
||||
setOptionsStateDisabled(product.productAttributes[index].name, true);
|
||||
optionsState[product.productAttributes[index].name][i]['disabled'] = false;
|
||||
setOptionsStateDisabled(product.productAttributes![index].name, true);
|
||||
optionsState[product.productAttributes![index].name][i]['disabled'] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, dynamic>> optionState = optionsState[product.productAttributes[index].name];
|
||||
List<Map<String, dynamic>> optionState = optionsState[product.productAttributes![index].name];
|
||||
for (var i = 0; i < optionState.length; i++) {
|
||||
Widget optionWidget = _getOptionRadio(
|
||||
product.productAttributes[index].productOptions[i], optionState[i]['disabled'], i);
|
||||
product.productAttributes![index].productOptions![i], optionState[i]['disabled'], i);
|
||||
row.children.add(optionWidget);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
bool _checkOptionIsCheck(String name) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes[index].name, name) != -1) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes![index].name, name) != -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -255,7 +255,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
new Text(
|
||||
(productOption.adjustAmount + extraAdjustAmount) > 0 ? '+${(productOption.adjustAmount + extraAdjustAmount).toStringAsFixed(2)}' : '',
|
||||
(productOption.adjustAmount! + extraAdjustAmount) > 0 ? '+${(productOption.adjustAmount! + extraAdjustAmount).toStringAsFixed(2)}' : '',
|
||||
style: new TextStyle(
|
||||
fontSize: 11.0,
|
||||
color: check ? selectedTextColor : new Color(0xFFABABAB),
|
||||
@@ -266,7 +266,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
),
|
||||
),
|
||||
onTap: () => disabled ? null : _onOptionTappedCallback(
|
||||
productOption.name, 0, productOption.adjustAmount + extraAdjustAmount, optIndex, productOption),
|
||||
productOption.name, 0, productOption.adjustAmount! + extraAdjustAmount, optIndex, productOption),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user