Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Most of the tutorial is outdated #19

Open
yolowex opened this issue Oct 23, 2023 · 1 comment
Open

Most of the tutorial is outdated #19

yolowex opened this issue Oct 23, 2023 · 1 comment

Comments

@yolowex
Copy link

yolowex commented Oct 23, 2023

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:

class Student {

  String name; // Non-nullable instance field 'name' must be initialized.

  double _percent; // Non-nullable instance field '_percent' must be initialized.

  void set percentage(double marksSecured) => _percent = (marksSecured / 500) * 100;

  double get 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.

@m-aqsam
Copy link

m-aqsam commented Jan 27, 2024

Exactly i also found the same and many more .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants