FileLink.fromJson constructor

FileLink.fromJson(
  1. Object? json
)

Implementation

factory FileLink.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return FileLink(
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    expired: (map['expired'] as bool),
    expiresAt: map['expires_at'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['expires_at'] as int).toInt()),
    file: FileOrId.fromJson(map['file']),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    metadata: (map['metadata'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as String),
            )),
    url: map['url'] == null ? null : (map['url'] as String),
  );
}