Error1 :
class _ProductDataSource extends DataGridSource {
_ProductDataSource(List<_Product> products) {
_products = products.map<DataGridRow>((e) {
return DataGridRow(cells: [
DataGridCell<String>(
columnName: 'name',
value: e.name,
),
DataGridCell<double>(
columnName: 'price',
value: e.price,
),
DataGridCell<int>(
columnName: 'quantity',
value: e.quantity,
),
DataGridCell<double>(
columnName: 'total',
value: e.total,
),
]);
}).toList();
}
[Error Message]
Non-nullable instance field 'isDark' must be initialized. Try adding an initializer expression, or add a field initializer in this constructor, or mark it 'late'.
Error2 :
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("type1"),
Obx(() {
return DropdownButton( // Error!
isExpanded: true,
hint: paramController.hwType.value == null
? Text("type1")
: Text(
convertToTypeName.hwType(hwType
.values[paramController.hwType.value]
.toString()),
style: TextStyle(color: Colors.blue),
),
items: hwTypeItems(),
value: paramController.hwType.value,
onChanged: (val) {
paramController.setHwType(val as int);
},
);
}),
],
)),
[Error Message]
Couldn't infer type parameter 'T'. Tried to infer 'dynamic' for 'T' which doesn't work: Parameter 'onChanged' declared as 'void Function(T?)?' but argument is 'void Function(Object?)'. The type 'dynamic' was inferred from: Parameter 'items' declared as
'List<DropdownMenuItem>?' but argument is 'List<DropdownMenuItem>'. Parameter 'value' declared as 'T?' but argument is 'int'. Consider passing explicit type argument(s) to the generic.
Hello, This is a null-safety error that occurred after the version update to 2.12.3. Most of the errors in my project have resolved. The above two types of errors cannot be resolved. Is there a workaround?