Closed
Description
So I'm using your library and the files are generating just fine.
I'm wondering though... I've got the following class:
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import './product.dart';
part 'product_group.g.dart';
@JsonSerializable(nullable: false)
class ProductGroup {
final List<Product> products;
ProductGroup({this.products});
factory ProductGroup.fromJson(Map<String, dynamic> json) =>
_$ProductGroupFromJson(json);
Map<String, dynamic> toJson() => _$ProductGroupToJson(this);
}
All my models are going to have the same factory method and toJson methods. Would it not be better to just generate these in the .g.dart file?
Metadata
Metadata
Assignees
Labels
No labels