Files
friebetill 80f218097d Initial commit
Add Space version 2.0.1
2022-03-28 14:56:00 +02:00

37 lines
908 B
Dart

import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:json_annotation/json_annotation.dart';
import 'csv_card.dart';
part 'csv_deck.g.dart';
/// The data of an deck that will be imported.
@CopyWith()
@JsonSerializable()
class CSVDeck {
CSVDeck({
required this.name,
required this.cards,
});
/// Constructs a new [CSVDeck] from the given [json].
///
/// A conversion from JSON is especially useful in order to handle results
/// from an import.
factory CSVDeck.fromJson(Map<String, dynamic> json) {
return _$CSVDeckFromJson(json);
}
/// Name of deck
final String name;
/// Cards of the deck.
@JsonKey(defaultValue: [])
final List<CSVCard> cards;
/// Constructs a new json map from this [CSVDeck].
///
/// A conversion to JSON is useful in order to send through an isolate.
Map<String, dynamic> toJson() => _$CSVDeckToJson(this);
}