site-www icon indicating copy to clipboard operation
site-www copied to clipboard

Confusion regarding variable initialization

Open mojjammil opened this issue 5 years ago • 8 comments

The part where we Initialize _speed to 0:

It is confusing not knowing exactly where to initialize? Within the class or inside main, or outside?

mojjammil avatar Oct 11 '20 13:10 mojjammil

The part where we Initialize _speed to 0:

@mojjammil Could you please provide any reference to where you are getting confused?

sumandipanshu avatar Oct 11 '20 18:10 sumandipanshu

It's in Intro to Dart for Java Developers -> Create a simple Dart class -> Add a read-only variable - > Initialize _speed to 0:

Mentioning it needs to be declared within the class might be handier

mojjammil avatar Oct 12 '20 07:10 mojjammil

Mentioning it needs to be declared within the class might be handier

Dart implements privacy at library level, not the class level (unlike Java). So, placing it anywhere inside the same library would make no difference. Refer here.

~Duplicate of #1463~

sumandipanshu avatar Oct 12 '20 20:10 sumandipanshu

@sumandipanshu #1463 doesn't seem to be related. Was there another bug you meant to refer to?

kwalrath avatar Oct 12 '20 23:10 kwalrath

@kwalrath Ahh, sorry i mistakenly linked it to the another issue. This is the issue which i wanted to link, but it seems to be in a different repository.

sumandipanshu avatar Oct 13 '20 13:10 sumandipanshu

I understand now. We could be clearer about what we mean.

kwalrath avatar Oct 19 '20 23:10 kwalrath

I would like to work on this issue. But I'm confused about what needs to be done in order to resolve this issue? what kind of info we need to add there? And where is the source code?

sumandipanshu avatar Oct 20 '20 16:10 sumandipanshu

@sumandipanshu unfortunately this codelab isn't open source, so a Googler has to fix it. :(

kwalrath avatar Oct 20 '20 17:10 kwalrath

Thanks for the issue!

This codelab has been retired in favor of other learning material which we are working on improving and expanding, as the codelab was not up to date with modern Dart. We will be releasing more learning material over time, and for now, have a bunch of samples at https://dart.dev/language and a detailed walkthrough of different Dart features, that is written in a way that should be familiar to Java developers.

Thanks again!

parlough avatar May 31 '23 21:05 parlough