import 'package:freezed_annotation/freezed_annotation.dart'; part 'video_resolution.g.dart'; /// Width and height of a video. @JsonSerializable() class VideoResolution implements Comparable { /// Viewport width. final int width; /// Viewport height. final int height; /// Initializes an instance of [VideoResolution] const VideoResolution(this.width, this.height); factory VideoResolution.fromJson(Map json) => _$VideoResolutionFromJson(json); Map toJson() => _$VideoResolutionToJson(this); @override String toString() => '${width}x$height'; @override int compareTo(VideoResolution other) { if (width == other.width && height == other.height) { return 0; } if (width > other.width) { return 1; } if (width == other.width && height > other.height) { return 1; } return -1; } }