File.fromJson constructor
File.fromJson(
- Object? json
Implementation
factory File.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return File(
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
expiresAt: map['expires_at'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['expires_at'] as int).toInt()),
filename: map['filename'] == null ? null : (map['filename'] as String),
id: (map['id'] as String),
links: map['links'] == null ? null : FileLinks.fromJson(map['links']),
purpose: FilePurpose.fromJson(map['purpose']),
size: (map['size'] as num).toInt(),
title: map['title'] == null ? null : (map['title'] as String),
type: map['type'] == null ? null : (map['type'] as String),
url: map['url'] == null ? null : (map['url'] as String),
);
}