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

Replace " by ' for the dart language #1625

Open
Hesamedin opened this issue Jan 6, 2021 · 1 comment
Open

Replace " by ' for the dart language #1625

Hesamedin opened this issue Jan 6, 2021 · 1 comment

Comments

@Hesamedin
Copy link

Please add an option in the Options list that let me replace " by '. This is the recommended notation by Dart.

For instance, this is the code generated by your interface:

class UsaState {
    UsaState({
        @required this.name,
        @required this.abbreviation,
    });

    final String name;
    final String abbreviation;

    factory UsaState.fromJson(Map<String, dynamic> json) => UsaState(
        name: json["name"],
        abbreviation: json["abbreviation"],
    );

    Map<String, dynamic> toJson() => {
        "name": name,
        "abbreviation": abbreviation,
    };
}

This is what it needs to be in Dart:

class UsaState {
  UsaState({
    @required this.name,
    @required this.abbreviation,
  });

  final String name;
  final String abbreviation;

  factory UsaState.fromJson(Map<String, dynamic> json) => UsaState(
        name: json['name'],
        abbreviation: json['abbreviation'],
      );

  Map<String, dynamic> toJson() => {
        'name': name,
        'abbreviation': abbreviation,
      };
}
``

@freemansoft
Copy link

Single quotes are the standard. The tool should just generate single quotes.

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