26 lines
423 B
Dart
26 lines
423 B
Dart
// quote model class
|
|
|
|
class Quote{
|
|
final int id;
|
|
final String author;
|
|
final String body;
|
|
|
|
const Quote({
|
|
required this.id,
|
|
required this.author,
|
|
required this.body,
|
|
});
|
|
|
|
factory Quote.fromJson(Map<String, dynamic> json) {
|
|
return Quote(
|
|
id: json['id'],
|
|
author: json['author'],
|
|
body: json['body'],
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return "$body - $author";
|
|
}
|
|
} |