youtube_explode/lib/src/videos/streams/framerate.dart

29 lines
707 B
Dart
Raw Normal View History

import 'package:freezed_annotation/freezed_annotation.dart';
2020-06-03 13:18:37 +02:00
part 'framerate.freezed.dart';
2020-06-03 13:18:37 +02:00
/// Encapsulates framerate.
@freezed
class Framerate with Comparable<Framerate>, _$Framerate {
2020-06-03 13:18:37 +02:00
/// Initialize an instance of [Framerate]
const factory Framerate(
/// Framerate as frames per second
num framesPerSecond) = _Framerate;
const Framerate._();
2020-06-03 13:18:37 +02:00
///
bool operator >(Framerate other) => framesPerSecond > other.framesPerSecond;
///
bool operator <(Framerate other) => framesPerSecond < other.framesPerSecond;
@override
2021-10-04 13:00:22 +02:00
String toString() => '${framesPerSecond}fps';
2020-06-03 13:18:37 +02:00
@override
int compareTo(Framerate other) =>
framesPerSecond.compareTo(other.framesPerSecond);
2020-06-05 21:06:54 +02:00
}