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

[dart/en] Learn Dart broken #4461

Open
HeyItsJono opened this issue Jul 21, 2022 · 7 comments
Open

[dart/en] Learn Dart broken #4461

HeyItsJono opened this issue Jul 21, 2022 · 7 comments

Comments

@HeyItsJono
Copy link

Hi there, thanks for this awesome resource.

Attempting to run the current Learn Dart page in the latest version of dart throws several errors:

: Warning: Operand of null-aware operation '??' has type 'bool' which excludes null.
var hasString = isBool ?? "default String";
                ^

: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
CONSTANT_VALUE = "DID I?"; //Error
^^^^^^^^^^^^^^
: Error: 'CONSTANT_VALUE' is already declared in this scope.
CONSTANT_VALUE = "DID I?"; //Error
^^^^^^^^^^^^^^
: Context: Previous declaration of 'CONSTANT_VALUE'.
const CONSTANT_VALUE = "I CANNOT CHANGE";
      ^^^^^^^^^^^^^^
: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
finalValue = "Seems not"; //Error
^^^^^^^^^^
: Error: 'finalValue' is already declared in this scope.
finalValue = "Seems not"; //Error
^^^^^^^^^^
: Context: Previous declaration of 'finalValue'.
final finalValue = "value cannot be change once instantiated";
      ^^^^^^^^^^
: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
mutableValue = "this is valid";
^^^^^^^^^^^^
: Error: 'mutableValue' is already declared in this scope.
mutableValue = "this is valid";
^^^^^^^^^^^^
: Context: Previous declaration of 'mutableValue'.
var mutableValue = "Variable string";
    ^^^^^^^^^^^^
: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
mutableValue = false; // Error.
^^^^^^^^^^^^

Exited (254)

@mribeirodantas
Copy link
Collaborator

mribeirodantas commented Jul 21, 2022

Thanks for reporting this, @HeyItsJono!

I will mention the contributors of the Dart documentation file. Maybe someone among them will be willing to fix this.

@jpedrosa
@mxschumacher
@divayprakash
@Hiyorimi
@vinceramcesoliveros
@sridhareaswaran
@prertik
@sophiabrandt
@samcv
@okry1123
@ghalley
@AntonTrekov
@stranger26
@smith558

@mribeirodantas mribeirodantas changed the title [language/dart] Learn Dart broken [dart/en] Learn Dart broken Jul 21, 2022
@gochev
Copy link

gochev commented May 22, 2023

there are a lot of issues in the dart version.

/// The Class constructor method uses the same name of the class and
/// takes the form of SomeClass() : super() {}, where the ": super()"
/// part is optional and it's used to delegate constant parameters to the
/// super-parent's constructor.
class Example24A {
  var _value;
  Example24A({value: "someValue"}) {
    _value = value;
  }
  get value => _value;
}

it uses : instead of = so many many mistakes :()

@mribeirodantas
Copy link
Collaborator

That's unfortunate. Would you be willing to improve the article, @gochev?

@gochev
Copy link

gochev commented May 23, 2023

@mribeirodantas I will rewrite it and fix all in the upcoming days

@HeyItsJono
Copy link
Author

Amazing, thanks so much for taking the time to fix this up!

@gochev
Copy link

gochev commented May 24, 2023

I fixed compilation errors in #4673

HOWEVER I believe we should:

  1. format the code since it is super badly formatted.
  2. improve this with examples from dart 2 and dart 3. Basically nullable values are not explained properly and all dart 3 features are missing. Overall everything was stuck with very old versions of dart and many examples are no longer relevant or written the best way.

I can work on this 2 if you tell me to in the next week or so. I believe this can be much better then it is.

@gochev
Copy link

gochev commented May 24, 2023

@HeyItsJono some of the initial examples are made to fail by design. However I agree it is not the best we can improve it for the next commits.

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

3 participants