Statement.fromJson constructor
Statement.fromJson(
- Map<String, dynamic> json
)
Implementation
factory Statement.fromJson(Map<String, dynamic> json) {
// Note: Depending on how your StatementObject (Activity / Agent) subclasses are structured,
// you may need to adjust the object deserialization, but this covers standard xAPI fields.
return Statement(
version: json['version'] ?? "1.0.3",
actor: Actor.fromJson(json['actor']),
verb: Verb.fromJson(json['verb']),
object: Object.fromJson(json['object']),
timestamp: json['timestamp'] != null
? DateTime.parse(json['timestamp'])
: null,
result: json['result'] != null ? Result.fromJson(json['result']) : null,
context: json['context'] != null
? Context.fromJson(json['context'])
: null,
);
}