You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just started with dart but it seems that this tutorial is outdated and the most recent dart version has
groundbreaking changes that break backwards compatibility.
this is from 21_getters_setters for example:
classStudent {
String name; // Non-nullable instance field 'name' must be initialized.double _percent; // Non-nullable instance field '_percent' must be initialized.voidsetpercentage(double marksSecured) => _percent = (marksSecured /500) *100;
doubleget percentage => _percent;
}
I copied the errors that dartpad.dev gave me, into the code above as comments.
both the name and _percent fields have to be initialized now. it's saying about non-nullable types,
I'm pretty sure I read somewhere that every type in dart is an object and therefore set to null when initialized without a value.
The text was updated successfully, but these errors were encountered:
I just started with dart but it seems that this tutorial is outdated and the most recent dart version has
groundbreaking changes that break backwards compatibility.
this is from 21_getters_setters for example:
I copied the errors that dartpad.dev gave me, into the code above as comments.
both the name and _percent fields have to be initialized now. it's saying about non-nullable types,
I'm pretty sure I read somewhere that every type in dart is an object and therefore set to null when initialized without a value.
The text was updated successfully, but these errors were encountered: