diff --git a/lib/src/types/video_dimensions.dart b/lib/src/types/video_dimensions.dart index b168811..1ab7d16 100644 --- a/lib/src/types/video_dimensions.dart +++ b/lib/src/types/video_dimensions.dart @@ -24,6 +24,19 @@ class VideoDimensions { width ?? this.width, height ?? this.height, ); + + // ---------------------------------------------------------------------- + // equality + + @override + bool operator ==(Object other) => + identical(this, other) || + other is VideoDimensions && + width == other.width && + height == other.height; + + @override + int get hashCode => Object.hash(width, height); } extension VideoDimensionsHelpers on VideoDimensions { diff --git a/lib/src/types/video_encoding.dart b/lib/src/types/video_encoding.dart index 5a8d507..db96dcd 100644 --- a/lib/src/types/video_encoding.dart +++ b/lib/src/types/video_encoding.dart @@ -15,6 +15,19 @@ class VideoEncoding { @override String toString() => '${runtimeType}(maxFramerate: ${maxFramerate}, maxBitrate: ${maxBitrate})'; + + // ---------------------------------------------------------------------- + // equality + + @override + bool operator ==(Object other) => + identical(this, other) || + other is VideoEncoding && + maxFramerate == other.maxFramerate && + maxBitrate == other.maxBitrate; + + @override + int get hashCode => Object.hash(maxFramerate, maxBitrate); } /// Convenience extension for [VideoEncoding]. diff --git a/lib/src/types/video_parameters.dart b/lib/src/types/video_parameters.dart index 1cfc991..c0a9d88 100644 --- a/lib/src/types/video_parameters.dart +++ b/lib/src/types/video_parameters.dart @@ -15,6 +15,20 @@ class VideoParameters { required this.encoding, }); + // ---------------------------------------------------------------------- + // equality + + @override + bool operator ==(Object other) => + identical(this, other) || + other is VideoParameters && + description == other.description && + dimensions == other.dimensions && + encoding == other.encoding; + + @override + int get hashCode => Object.hash(description, dimensions, encoding); + // // TODO: Return constraints that will work for all platforms (Web & Mobile) // https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia