FileLinkCreateOptions.fromJson constructor

FileLinkCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory FileLinkCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return FileLinkCreateOptions(
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    expiresAt: map['expires_at'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['expires_at'] as int).toInt()),
    file: (map['file'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
  );
}