Skip to content

Conversation

@kevmoo
Copy link
Collaborator

@kevmoo kevmoo commented Jun 8, 2018

Controls how toJson functionality is generated for all types processed
by this generator.

If false (the default), a private _$ClassNameSerializerMixin class is
created in the generated part file which contains a toJson method.

Mix in this class to the source class:

@JsonSerializable()
class Example extends Object with _$ExampleSerializerMixin {
  // ...
}

If true, then a top-level function is created that you can reference
from your class.

@JsonSerializable()
class Example {
  // ...
  Map<String, dynamic> toJson() => _$ExampleToJson(this);
}

Controls how `toJson` functionality is generated for all types processed
by this generator.

If `false` (the default), a private `_$ClassNameSerializerMixin` class is
created in the generated part file which contains a `toJson` method.

Mix in this class to the source class:

```dart
@JsonSerializable()
class Example extends Object with _$ExampleSerializerMixin {
  // ...
}
```

If `true`, then a top-level function is created that you can reference
from your class.

```dart
@JsonSerializable()
class Example {
  // ...
  Map<String, dynamic> toJson() => _$ExampleToJson(this);
}
```
@kevmoo kevmoo requested a review from jakemac53 June 8, 2018 15:35
} else {
//
// Generate the mixin class
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D?

@kevmoo kevmoo merged commit 23d0f3d into master Jun 8, 2018
@kevmoo kevmoo deleted the toJsonFunction branch June 8, 2018 15:53
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

Successfully merging this pull request may close these issues.

3 participants