I am following a Flutter tutorial that has such a following code, but code doesn't work on my computer, and I don't know how to fix it:
import 'package:flutter/foundation.dart';
class CartItem {
final String id;
CartItem({
@required this.id,
});
}
But I get such these errors:
The parameter 'id' can't have a value of 'null' because of its type, but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.dartmissing_default_value_for_parameter
{String id}