This is a piece of external code I work with.
class Entry {
const Entry({this.entry, @required this.entryId});
final String entryId;
final String entry;
factory Entry.fromJson(Map<String, dynamic> json) {
return Entry(entry: json['entry'], entryId: json['entryId']);
}
Map<String, dynamic> toMap() {
return {'entry': entry, 'entryId': entryId};
}
}
What is a purpose of factory
there?
It's not a singleton pattern usage, then what is it?
The named constructor Entry.fromJson
just creates an instance of Entry
from json values, then what is the factory
keyword meaning?