diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 902f0e1..43d6654 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - uses: subosito/flutter-action@v2 with: # Matches the `flutter: ">=3.44.0"` constraint in pubspec.yaml. - flutter-version: 3.44.0 + flutter-version: 3.47.2 channel: stable cache: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ff21e7..44ccfaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2.0.0 + +- Breaking: requires Dart 3.13 / Flutter 3.47. +- Breaking: `freezed_annotation` 2 -> 3. Freezed models are now `Diagnosticable`, so their + `toString({DiagnosticLevel})` cannot be satisfied by mockito's `SmartFake`. +- Breaking: `freezed` moved from dependencies to dev_dependencies. +- Chore: `pigeon` 22 -> 28, `build_runner` 2.16, `mockito` 5.8. + ## 1.1.2 - Feature: setVolume(double) diff --git a/example/pubspec.lock b/example/pubspec.lock index 398f712..a2f6dc6 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,22 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f - url: "https://pub.dev" - source: hosted - version: "85.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d" - url: "https://pub.dev" - source: hosted - version: "7.7.1" args: dependency: transitive description: @@ -39,7 +23,7 @@ packages: path: ".." relative: true source: path - version: "1.3.0" + version: "1.3.1" boolean_selector: dependency: transitive description: @@ -48,22 +32,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" - build: - dependency: transitive - description: - name: build - sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0 - url: "https://pub.dev" - source: hosted - version: "2.4.2" - build_config: - dependency: transitive - description: - name: build_config - sha256: d466ed2dc9c6cd1d169948879b84ee061eb5e22c64a7c6089879c6296d272a8d - url: "https://pub.dev" - source: hosted - version: "1.3.3" characters: dependency: transitive description: @@ -72,14 +40,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.1" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" - url: "https://pub.dev" - source: hosted - version: "2.0.4" clock: dependency: transitive description: @@ -112,14 +72,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" - convert: - dependency: transitive - description: - name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 - url: "https://pub.dev" - source: hosted - version: "3.1.2" crypto: dependency: transitive description: @@ -136,14 +88,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.9" - dart_style: - dependency: transitive - description: - name: dart_style - sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" - url: "https://pub.dev" - source: hosted - version: "3.1.1" dbus: dependency: transitive description: @@ -176,14 +120,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.2" - file: - dependency: transitive - description: - name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 - url: "https://pub.dev" - source: hosted - version: "7.0.1" fixnum: dependency: transitive description: @@ -263,30 +199,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.2" - freezed: - dependency: transitive - description: - name: freezed - sha256: "59a584c24b3acdc5250bb856d0d3e9c0b798ed14a4af1ddb7dc1c7b41df91c9c" - url: "https://pub.dev" - source: hosted - version: "2.5.8" freezed_annotation: dependency: transitive description: name: freezed_annotation - sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 - url: "https://pub.dev" - source: hosted - version: "2.4.4" - glob: - dependency: transitive - description: - name: glob - sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "3.1.0" hooks_riverpod: dependency: "direct main" description: @@ -359,14 +279,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" - logging: - dependency: transitive - description: - name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 - url: "https://pub.dev" - source: hosted - version: "1.3.0" matcher: dependency: transitive description: @@ -407,14 +319,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.0" - package_config: - dependency: transitive - description: - name: package_config - sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc - url: "https://pub.dev" - source: hosted - version: "2.2.0" package_info_plus: dependency: transitive description: @@ -471,22 +375,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.5+1" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" - url: "https://pub.dev" - source: hosted - version: "2.2.1" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - sha256: c38b81cbf34450b67e0265d73433569d12e34782e30ed769c9cc99c9d5f2e796 - url: "https://pub.dev" - source: hosted - version: "1.6.0" riverpod: dependency: "direct main" description: @@ -500,14 +388,6 @@ packages: description: flutter source: sdk version: "0.0.0" - source_gen: - dependency: transitive - description: - name: source_gen - sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" - url: "https://pub.dev" - source: hosted - version: "2.0.0" source_span: dependency: transitive description: @@ -644,14 +524,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.7.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" - url: "https://pub.dev" - source: hosted - version: "1.2.1" web: dependency: transitive description: @@ -676,14 +548,6 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.1" - yaml: - dependency: transitive - description: - name: yaml - sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea - url: "https://pub.dev" - source: hosted - version: "3.1.4" sdks: - dart: ">=3.12.0 <4.0.0" - flutter: ">=3.44.0" + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.0" diff --git a/lib/src/state/player_state_notifier.freezed.dart b/lib/src/state/player_state_notifier.freezed.dart index e42ef4f..6054cbd 100644 --- a/lib/src/state/player_state_notifier.freezed.dart +++ b/lib/src/state/player_state_notifier.freezed.dart @@ -1,6 +1,6 @@ -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint +// coverage:ignore-file +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'player_state_notifier.dart'; @@ -9,432 +9,320 @@ part of 'player_state_notifier.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// dart format off T _$identity(T value) => value; +/// @nodoc +mixin _$PlayerState implements DiagnosticableTreeMixin { -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + String get playerId; MediaItem? get currentMediaItem; VideoSize? get videoSize; int? get playbackPositionMs; double get playbackSpeed; bool get isNativeFullscreen; PlaybackState get playbackState; bool get isBuffering; bool get isInPipMode; bool get isInitialized; int? get textureId; double? get volume; PlayerError? get error; +/// Create a copy of PlayerState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PlayerStateCopyWith get copyWith => _$PlayerStateCopyWithImpl(this as PlayerState, _$identity); -/// @nodoc -mixin _$PlayerState { - String get playerId => throw _privateConstructorUsedError; - MediaItem? get currentMediaItem => throw _privateConstructorUsedError; - VideoSize? get videoSize => throw _privateConstructorUsedError; - int? get playbackPositionMs => throw _privateConstructorUsedError; - double get playbackSpeed => throw _privateConstructorUsedError; - bool get isNativeFullscreen => throw _privateConstructorUsedError; - PlaybackState get playbackState => throw _privateConstructorUsedError; - bool get isBuffering => throw _privateConstructorUsedError; - bool get isInPipMode => throw _privateConstructorUsedError; - bool get isInitialized => throw _privateConstructorUsedError; - int? get textureId => throw _privateConstructorUsedError; - double? get volume => throw _privateConstructorUsedError; - PlayerError? get error => throw _privateConstructorUsedError; - - /// Create a copy of PlayerState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PlayerStateCopyWith get copyWith => - throw _privateConstructorUsedError; + +@override +void debugFillProperties(DiagnosticPropertiesBuilder properties) { + final _this = this as PlayerState; + properties + ..add(DiagnosticsProperty('type', 'PlayerState')) + ..add(DiagnosticsProperty('playerId', _this.playerId))..add(DiagnosticsProperty('currentMediaItem', _this.currentMediaItem))..add(DiagnosticsProperty('videoSize', _this.videoSize))..add(DiagnosticsProperty('playbackPositionMs', _this.playbackPositionMs))..add(DiagnosticsProperty('playbackSpeed', _this.playbackSpeed))..add(DiagnosticsProperty('isNativeFullscreen', _this.isNativeFullscreen))..add(DiagnosticsProperty('playbackState', _this.playbackState))..add(DiagnosticsProperty('isBuffering', _this.isBuffering))..add(DiagnosticsProperty('isInPipMode', _this.isInPipMode))..add(DiagnosticsProperty('isInitialized', _this.isInitialized))..add(DiagnosticsProperty('textureId', _this.textureId))..add(DiagnosticsProperty('volume', _this.volume))..add(DiagnosticsProperty('error', _this.error)); } -/// @nodoc -abstract class $PlayerStateCopyWith<$Res> { - factory $PlayerStateCopyWith( - PlayerState value, $Res Function(PlayerState) then) = - _$PlayerStateCopyWithImpl<$Res, PlayerState>; - @useResult - $Res call( - {String playerId, - MediaItem? currentMediaItem, - VideoSize? videoSize, - int? playbackPositionMs, - double playbackSpeed, - bool isNativeFullscreen, - PlaybackState playbackState, - bool isBuffering, - bool isInPipMode, - bool isInitialized, - int? textureId, - double? volume, - PlayerError? error}); +@override +bool operator ==(Object other) { + final _this = this as PlayerState; + return identical(this, other) || (other.runtimeType == runtimeType&&other is PlayerState&&(identical(other.playerId, _this.playerId) || other.playerId == _this.playerId)&&(identical(other.currentMediaItem, _this.currentMediaItem) || other.currentMediaItem == _this.currentMediaItem)&&(identical(other.videoSize, _this.videoSize) || other.videoSize == _this.videoSize)&&(identical(other.playbackPositionMs, _this.playbackPositionMs) || other.playbackPositionMs == _this.playbackPositionMs)&&(identical(other.playbackSpeed, _this.playbackSpeed) || other.playbackSpeed == _this.playbackSpeed)&&(identical(other.isNativeFullscreen, _this.isNativeFullscreen) || other.isNativeFullscreen == _this.isNativeFullscreen)&&(identical(other.playbackState, _this.playbackState) || other.playbackState == _this.playbackState)&&(identical(other.isBuffering, _this.isBuffering) || other.isBuffering == _this.isBuffering)&&(identical(other.isInPipMode, _this.isInPipMode) || other.isInPipMode == _this.isInPipMode)&&(identical(other.isInitialized, _this.isInitialized) || other.isInitialized == _this.isInitialized)&&(identical(other.textureId, _this.textureId) || other.textureId == _this.textureId)&&(identical(other.volume, _this.volume) || other.volume == _this.volume)&&(identical(other.error, _this.error) || other.error == _this.error)); } -/// @nodoc -class _$PlayerStateCopyWithImpl<$Res, $Val extends PlayerState> - implements $PlayerStateCopyWith<$Res> { - _$PlayerStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PlayerState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? playerId = null, - Object? currentMediaItem = freezed, - Object? videoSize = freezed, - Object? playbackPositionMs = freezed, - Object? playbackSpeed = null, - Object? isNativeFullscreen = null, - Object? playbackState = null, - Object? isBuffering = null, - Object? isInPipMode = null, - Object? isInitialized = null, - Object? textureId = freezed, - Object? volume = freezed, - Object? error = freezed, - }) { - return _then(_value.copyWith( - playerId: null == playerId - ? _value.playerId - : playerId // ignore: cast_nullable_to_non_nullable - as String, - currentMediaItem: freezed == currentMediaItem - ? _value.currentMediaItem - : currentMediaItem // ignore: cast_nullable_to_non_nullable - as MediaItem?, - videoSize: freezed == videoSize - ? _value.videoSize - : videoSize // ignore: cast_nullable_to_non_nullable - as VideoSize?, - playbackPositionMs: freezed == playbackPositionMs - ? _value.playbackPositionMs - : playbackPositionMs // ignore: cast_nullable_to_non_nullable - as int?, - playbackSpeed: null == playbackSpeed - ? _value.playbackSpeed - : playbackSpeed // ignore: cast_nullable_to_non_nullable - as double, - isNativeFullscreen: null == isNativeFullscreen - ? _value.isNativeFullscreen - : isNativeFullscreen // ignore: cast_nullable_to_non_nullable - as bool, - playbackState: null == playbackState - ? _value.playbackState - : playbackState // ignore: cast_nullable_to_non_nullable - as PlaybackState, - isBuffering: null == isBuffering - ? _value.isBuffering - : isBuffering // ignore: cast_nullable_to_non_nullable - as bool, - isInPipMode: null == isInPipMode - ? _value.isInPipMode - : isInPipMode // ignore: cast_nullable_to_non_nullable - as bool, - isInitialized: null == isInitialized - ? _value.isInitialized - : isInitialized // ignore: cast_nullable_to_non_nullable - as bool, - textureId: freezed == textureId - ? _value.textureId - : textureId // ignore: cast_nullable_to_non_nullable - as int?, - volume: freezed == volume - ? _value.volume - : volume // ignore: cast_nullable_to_non_nullable - as double?, - error: freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as PlayerError?, - ) as $Val); - } + +@override +int get hashCode { + final _this = this as PlayerState; + return Object.hash(runtimeType,_this.playerId,_this.currentMediaItem,_this.videoSize,_this.playbackPositionMs,_this.playbackSpeed,_this.isNativeFullscreen,_this.playbackState,_this.isBuffering,_this.isInPipMode,_this.isInitialized,_this.textureId,_this.volume,_this.error); } +@override +String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { + final _this = this as PlayerState; + return 'PlayerState(playerId: ${_this.playerId}, currentMediaItem: ${_this.currentMediaItem}, videoSize: ${_this.videoSize}, playbackPositionMs: ${_this.playbackPositionMs}, playbackSpeed: ${_this.playbackSpeed}, isNativeFullscreen: ${_this.isNativeFullscreen}, playbackState: ${_this.playbackState}, isBuffering: ${_this.isBuffering}, isInPipMode: ${_this.isInPipMode}, isInitialized: ${_this.isInitialized}, textureId: ${_this.textureId}, volume: ${_this.volume}, error: ${_this.error})'; +} + + +} + +/// @nodoc +abstract mixin class $PlayerStateCopyWith<$Res> { + factory $PlayerStateCopyWith(PlayerState value, $Res Function(PlayerState) _then) = _$PlayerStateCopyWithImpl; +@useResult +$Res call({ + String playerId, MediaItem? currentMediaItem, VideoSize? videoSize, int? playbackPositionMs, double playbackSpeed, bool isNativeFullscreen, PlaybackState playbackState, bool isBuffering, bool isInPipMode, bool isInitialized, int? textureId, double? volume, PlayerError? error +}); + + + + +} /// @nodoc -abstract class _$$PlayerStateImplCopyWith<$Res> +class _$PlayerStateCopyWithImpl<$Res> implements $PlayerStateCopyWith<$Res> { - factory _$$PlayerStateImplCopyWith( - _$PlayerStateImpl value, $Res Function(_$PlayerStateImpl) then) = - __$$PlayerStateImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String playerId, - MediaItem? currentMediaItem, - VideoSize? videoSize, - int? playbackPositionMs, - double playbackSpeed, - bool isNativeFullscreen, - PlaybackState playbackState, - bool isBuffering, - bool isInPipMode, - bool isInitialized, - int? textureId, - double? volume, - PlayerError? error}); + _$PlayerStateCopyWithImpl(this._self, this._then); + + final PlayerState _self; + final $Res Function(PlayerState) _then; + +/// Create a copy of PlayerState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? playerId = null,Object? currentMediaItem = freezed,Object? videoSize = freezed,Object? playbackPositionMs = freezed,Object? playbackSpeed = null,Object? isNativeFullscreen = null,Object? playbackState = null,Object? isBuffering = null,Object? isInPipMode = null,Object? isInitialized = null,Object? textureId = freezed,Object? volume = freezed,Object? error = freezed,}) { + return _then(PlayerState( +playerId: null == playerId ? _self.playerId : playerId // ignore: cast_nullable_to_non_nullable +as String,currentMediaItem: freezed == currentMediaItem ? _self.currentMediaItem : currentMediaItem // ignore: cast_nullable_to_non_nullable +as MediaItem?,videoSize: freezed == videoSize ? _self.videoSize : videoSize // ignore: cast_nullable_to_non_nullable +as VideoSize?,playbackPositionMs: freezed == playbackPositionMs ? _self.playbackPositionMs : playbackPositionMs // ignore: cast_nullable_to_non_nullable +as int?,playbackSpeed: null == playbackSpeed ? _self.playbackSpeed : playbackSpeed // ignore: cast_nullable_to_non_nullable +as double,isNativeFullscreen: null == isNativeFullscreen ? _self.isNativeFullscreen : isNativeFullscreen // ignore: cast_nullable_to_non_nullable +as bool,playbackState: null == playbackState ? _self.playbackState : playbackState // ignore: cast_nullable_to_non_nullable +as PlaybackState,isBuffering: null == isBuffering ? _self.isBuffering : isBuffering // ignore: cast_nullable_to_non_nullable +as bool,isInPipMode: null == isInPipMode ? _self.isInPipMode : isInPipMode // ignore: cast_nullable_to_non_nullable +as bool,isInitialized: null == isInitialized ? _self.isInitialized : isInitialized // ignore: cast_nullable_to_non_nullable +as bool,textureId: freezed == textureId ? _self.textureId : textureId // ignore: cast_nullable_to_non_nullable +as int?,volume: freezed == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable +as double?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as PlayerError?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [PlayerState]. +extension PlayerStatePatterns on PlayerState { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _PlayerState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PlayerState() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _PlayerState value) $default,){ +final _that = this; +switch (_that) { +case _PlayerState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _PlayerState value)? $default,){ +final _that = this; +switch (_that) { +case _PlayerState() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String playerId, MediaItem? currentMediaItem, VideoSize? videoSize, int? playbackPositionMs, double playbackSpeed, bool isNativeFullscreen, PlaybackState playbackState, bool isBuffering, bool isInPipMode, bool isInitialized, int? textureId, double? volume, PlayerError? error)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PlayerState() when $default != null: +return $default(_that.playerId,_that.currentMediaItem,_that.videoSize,_that.playbackPositionMs,_that.playbackSpeed,_that.isNativeFullscreen,_that.playbackState,_that.isBuffering,_that.isInPipMode,_that.isInitialized,_that.textureId,_that.volume,_that.error);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String playerId, MediaItem? currentMediaItem, VideoSize? videoSize, int? playbackPositionMs, double playbackSpeed, bool isNativeFullscreen, PlaybackState playbackState, bool isBuffering, bool isInPipMode, bool isInitialized, int? textureId, double? volume, PlayerError? error) $default,) {final _that = this; +switch (_that) { +case _PlayerState(): +return $default(_that.playerId,_that.currentMediaItem,_that.videoSize,_that.playbackPositionMs,_that.playbackSpeed,_that.isNativeFullscreen,_that.playbackState,_that.isBuffering,_that.isInPipMode,_that.isInitialized,_that.textureId,_that.volume,_that.error);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String playerId, MediaItem? currentMediaItem, VideoSize? videoSize, int? playbackPositionMs, double playbackSpeed, bool isNativeFullscreen, PlaybackState playbackState, bool isBuffering, bool isInPipMode, bool isInitialized, int? textureId, double? volume, PlayerError? error)? $default,) {final _that = this; +switch (_that) { +case _PlayerState() when $default != null: +return $default(_that.playerId,_that.currentMediaItem,_that.videoSize,_that.playbackPositionMs,_that.playbackSpeed,_that.isNativeFullscreen,_that.playbackState,_that.isBuffering,_that.isInPipMode,_that.isInitialized,_that.textureId,_that.volume,_that.error);case _: + return null; + +} } -/// @nodoc -class __$$PlayerStateImplCopyWithImpl<$Res> - extends _$PlayerStateCopyWithImpl<$Res, _$PlayerStateImpl> - implements _$$PlayerStateImplCopyWith<$Res> { - __$$PlayerStateImplCopyWithImpl( - _$PlayerStateImpl _value, $Res Function(_$PlayerStateImpl) _then) - : super(_value, _then); - - /// Create a copy of PlayerState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? playerId = null, - Object? currentMediaItem = freezed, - Object? videoSize = freezed, - Object? playbackPositionMs = freezed, - Object? playbackSpeed = null, - Object? isNativeFullscreen = null, - Object? playbackState = null, - Object? isBuffering = null, - Object? isInPipMode = null, - Object? isInitialized = null, - Object? textureId = freezed, - Object? volume = freezed, - Object? error = freezed, - }) { - return _then(_$PlayerStateImpl( - playerId: null == playerId - ? _value.playerId - : playerId // ignore: cast_nullable_to_non_nullable - as String, - currentMediaItem: freezed == currentMediaItem - ? _value.currentMediaItem - : currentMediaItem // ignore: cast_nullable_to_non_nullable - as MediaItem?, - videoSize: freezed == videoSize - ? _value.videoSize - : videoSize // ignore: cast_nullable_to_non_nullable - as VideoSize?, - playbackPositionMs: freezed == playbackPositionMs - ? _value.playbackPositionMs - : playbackPositionMs // ignore: cast_nullable_to_non_nullable - as int?, - playbackSpeed: null == playbackSpeed - ? _value.playbackSpeed - : playbackSpeed // ignore: cast_nullable_to_non_nullable - as double, - isNativeFullscreen: null == isNativeFullscreen - ? _value.isNativeFullscreen - : isNativeFullscreen // ignore: cast_nullable_to_non_nullable - as bool, - playbackState: null == playbackState - ? _value.playbackState - : playbackState // ignore: cast_nullable_to_non_nullable - as PlaybackState, - isBuffering: null == isBuffering - ? _value.isBuffering - : isBuffering // ignore: cast_nullable_to_non_nullable - as bool, - isInPipMode: null == isInPipMode - ? _value.isInPipMode - : isInPipMode // ignore: cast_nullable_to_non_nullable - as bool, - isInitialized: null == isInitialized - ? _value.isInitialized - : isInitialized // ignore: cast_nullable_to_non_nullable - as bool, - textureId: freezed == textureId - ? _value.textureId - : textureId // ignore: cast_nullable_to_non_nullable - as int?, - volume: freezed == volume - ? _value.volume - : volume // ignore: cast_nullable_to_non_nullable - as double?, - error: freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as PlayerError?, - )); - } } /// @nodoc -class _$PlayerStateImpl extends _PlayerState with DiagnosticableTreeMixin { - const _$PlayerStateImpl( - {required this.playerId, - this.currentMediaItem, - this.videoSize, - this.playbackPositionMs, - this.playbackSpeed = 1.0, - this.isNativeFullscreen = false, - this.playbackState = PlaybackState.stopped, - this.isBuffering = false, - this.isInPipMode = false, - this.isInitialized = false, - this.textureId, - this.volume, - this.error}) - : super._(); - - @override - final String playerId; - @override - final MediaItem? currentMediaItem; - @override - final VideoSize? videoSize; - @override - final int? playbackPositionMs; - @override - @JsonKey() - final double playbackSpeed; - @override - @JsonKey() - final bool isNativeFullscreen; - @override - @JsonKey() - final PlaybackState playbackState; - @override - @JsonKey() - final bool isBuffering; - @override - @JsonKey() - final bool isInPipMode; - @override - @JsonKey() - final bool isInitialized; - @override - final int? textureId; - @override - final double? volume; - @override - final PlayerError? error; - - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'PlayerState(playerId: $playerId, currentMediaItem: $currentMediaItem, videoSize: $videoSize, playbackPositionMs: $playbackPositionMs, playbackSpeed: $playbackSpeed, isNativeFullscreen: $isNativeFullscreen, playbackState: $playbackState, isBuffering: $isBuffering, isInPipMode: $isInPipMode, isInitialized: $isInitialized, textureId: $textureId, volume: $volume, error: $error)'; - } - @override - void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); +class _PlayerState extends PlayerState with DiagnosticableTreeMixin { + const _PlayerState({required this.playerId, this.currentMediaItem, this.videoSize, this.playbackPositionMs, this.playbackSpeed = 1.0, this.isNativeFullscreen = false, this.playbackState = PlaybackState.stopped, this.isBuffering = false, this.isInPipMode = false, this.isInitialized = false, this.textureId, this.volume, this.error}): super._(); + + +@override final String playerId; +@override final MediaItem? currentMediaItem; +@override final VideoSize? videoSize; +@override final int? playbackPositionMs; +@override@JsonKey() final double playbackSpeed; +@override@JsonKey() final bool isNativeFullscreen; +@override@JsonKey() final PlaybackState playbackState; +@override@JsonKey() final bool isBuffering; +@override@JsonKey() final bool isInPipMode; +@override@JsonKey() final bool isInitialized; +@override final int? textureId; +@override final double? volume; +@override final PlayerError? error; + +/// Create a copy of PlayerState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PlayerStateCopyWith<_PlayerState> get copyWith => __$PlayerStateCopyWithImpl<_PlayerState>(this, _$identity); + + +@override +void debugFillProperties(DiagnosticPropertiesBuilder properties) { properties - ..add(DiagnosticsProperty('type', 'PlayerState')) - ..add(DiagnosticsProperty('playerId', playerId)) - ..add(DiagnosticsProperty('currentMediaItem', currentMediaItem)) - ..add(DiagnosticsProperty('videoSize', videoSize)) - ..add(DiagnosticsProperty('playbackPositionMs', playbackPositionMs)) - ..add(DiagnosticsProperty('playbackSpeed', playbackSpeed)) - ..add(DiagnosticsProperty('isNativeFullscreen', isNativeFullscreen)) - ..add(DiagnosticsProperty('playbackState', playbackState)) - ..add(DiagnosticsProperty('isBuffering', isBuffering)) - ..add(DiagnosticsProperty('isInPipMode', isInPipMode)) - ..add(DiagnosticsProperty('isInitialized', isInitialized)) - ..add(DiagnosticsProperty('textureId', textureId)) - ..add(DiagnosticsProperty('volume', volume)) - ..add(DiagnosticsProperty('error', error)); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PlayerStateImpl && - (identical(other.playerId, playerId) || - other.playerId == playerId) && - (identical(other.currentMediaItem, currentMediaItem) || - other.currentMediaItem == currentMediaItem) && - (identical(other.videoSize, videoSize) || - other.videoSize == videoSize) && - (identical(other.playbackPositionMs, playbackPositionMs) || - other.playbackPositionMs == playbackPositionMs) && - (identical(other.playbackSpeed, playbackSpeed) || - other.playbackSpeed == playbackSpeed) && - (identical(other.isNativeFullscreen, isNativeFullscreen) || - other.isNativeFullscreen == isNativeFullscreen) && - (identical(other.playbackState, playbackState) || - other.playbackState == playbackState) && - (identical(other.isBuffering, isBuffering) || - other.isBuffering == isBuffering) && - (identical(other.isInPipMode, isInPipMode) || - other.isInPipMode == isInPipMode) && - (identical(other.isInitialized, isInitialized) || - other.isInitialized == isInitialized) && - (identical(other.textureId, textureId) || - other.textureId == textureId) && - (identical(other.volume, volume) || other.volume == volume) && - (identical(other.error, error) || other.error == error)); - } - - @override - int get hashCode => Object.hash( - runtimeType, - playerId, - currentMediaItem, - videoSize, - playbackPositionMs, - playbackSpeed, - isNativeFullscreen, - playbackState, - isBuffering, - isInPipMode, - isInitialized, - textureId, - volume, - error); - - /// Create a copy of PlayerState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PlayerStateImplCopyWith<_$PlayerStateImpl> get copyWith => - __$$PlayerStateImplCopyWithImpl<_$PlayerStateImpl>(this, _$identity); + ..add(DiagnosticsProperty('type', 'PlayerState')) + ..add(DiagnosticsProperty('playerId', playerId))..add(DiagnosticsProperty('currentMediaItem', currentMediaItem))..add(DiagnosticsProperty('videoSize', videoSize))..add(DiagnosticsProperty('playbackPositionMs', playbackPositionMs))..add(DiagnosticsProperty('playbackSpeed', playbackSpeed))..add(DiagnosticsProperty('isNativeFullscreen', isNativeFullscreen))..add(DiagnosticsProperty('playbackState', playbackState))..add(DiagnosticsProperty('isBuffering', isBuffering))..add(DiagnosticsProperty('isInPipMode', isInPipMode))..add(DiagnosticsProperty('isInitialized', isInitialized))..add(DiagnosticsProperty('textureId', textureId))..add(DiagnosticsProperty('volume', volume))..add(DiagnosticsProperty('error', error)); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PlayerState&&(identical(other.playerId, playerId) || other.playerId == playerId)&&(identical(other.currentMediaItem, currentMediaItem) || other.currentMediaItem == currentMediaItem)&&(identical(other.videoSize, videoSize) || other.videoSize == videoSize)&&(identical(other.playbackPositionMs, playbackPositionMs) || other.playbackPositionMs == playbackPositionMs)&&(identical(other.playbackSpeed, playbackSpeed) || other.playbackSpeed == playbackSpeed)&&(identical(other.isNativeFullscreen, isNativeFullscreen) || other.isNativeFullscreen == isNativeFullscreen)&&(identical(other.playbackState, playbackState) || other.playbackState == playbackState)&&(identical(other.isBuffering, isBuffering) || other.isBuffering == isBuffering)&&(identical(other.isInPipMode, isInPipMode) || other.isInPipMode == isInPipMode)&&(identical(other.isInitialized, isInitialized) || other.isInitialized == isInitialized)&&(identical(other.textureId, textureId) || other.textureId == textureId)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.error, error) || other.error == error)); +} + + +@override +int get hashCode { + return Object.hash(runtimeType,playerId,currentMediaItem,videoSize,playbackPositionMs,playbackSpeed,isNativeFullscreen,playbackState,isBuffering,isInPipMode,isInitialized,textureId,volume,error); +} + +@override +String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { + return 'PlayerState(playerId: $playerId, currentMediaItem: $currentMediaItem, videoSize: $videoSize, playbackPositionMs: $playbackPositionMs, playbackSpeed: $playbackSpeed, isNativeFullscreen: $isNativeFullscreen, playbackState: $playbackState, isBuffering: $isBuffering, isInPipMode: $isInPipMode, isInitialized: $isInitialized, textureId: $textureId, volume: $volume, error: $error)'; +} + + +} + +/// @nodoc +abstract mixin class _$PlayerStateCopyWith<$Res> implements $PlayerStateCopyWith<$Res> { + factory _$PlayerStateCopyWith(_PlayerState value, $Res Function(_PlayerState) _then) = __$PlayerStateCopyWithImpl; +@override @useResult +$Res call({ + String playerId, MediaItem? currentMediaItem, VideoSize? videoSize, int? playbackPositionMs, double playbackSpeed, bool isNativeFullscreen, PlaybackState playbackState, bool isBuffering, bool isInPipMode, bool isInitialized, int? textureId, double? volume, PlayerError? error +}); + + + + +} +/// @nodoc +class __$PlayerStateCopyWithImpl<$Res> + implements _$PlayerStateCopyWith<$Res> { + __$PlayerStateCopyWithImpl(this._self, this._then); + + final _PlayerState _self; + final $Res Function(_PlayerState) _then; + +/// Create a copy of PlayerState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? playerId = null,Object? currentMediaItem = freezed,Object? videoSize = freezed,Object? playbackPositionMs = freezed,Object? playbackSpeed = null,Object? isNativeFullscreen = null,Object? playbackState = null,Object? isBuffering = null,Object? isInPipMode = null,Object? isInitialized = null,Object? textureId = freezed,Object? volume = freezed,Object? error = freezed,}) { + return _then(_PlayerState( +playerId: null == playerId ? _self.playerId : playerId // ignore: cast_nullable_to_non_nullable +as String,currentMediaItem: freezed == currentMediaItem ? _self.currentMediaItem : currentMediaItem // ignore: cast_nullable_to_non_nullable +as MediaItem?,videoSize: freezed == videoSize ? _self.videoSize : videoSize // ignore: cast_nullable_to_non_nullable +as VideoSize?,playbackPositionMs: freezed == playbackPositionMs ? _self.playbackPositionMs : playbackPositionMs // ignore: cast_nullable_to_non_nullable +as int?,playbackSpeed: null == playbackSpeed ? _self.playbackSpeed : playbackSpeed // ignore: cast_nullable_to_non_nullable +as double,isNativeFullscreen: null == isNativeFullscreen ? _self.isNativeFullscreen : isNativeFullscreen // ignore: cast_nullable_to_non_nullable +as bool,playbackState: null == playbackState ? _self.playbackState : playbackState // ignore: cast_nullable_to_non_nullable +as PlaybackState,isBuffering: null == isBuffering ? _self.isBuffering : isBuffering // ignore: cast_nullable_to_non_nullable +as bool,isInPipMode: null == isInPipMode ? _self.isInPipMode : isInPipMode // ignore: cast_nullable_to_non_nullable +as bool,isInitialized: null == isInitialized ? _self.isInitialized : isInitialized // ignore: cast_nullable_to_non_nullable +as bool,textureId: freezed == textureId ? _self.textureId : textureId // ignore: cast_nullable_to_non_nullable +as int?,volume: freezed == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable +as double?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as PlayerError?, + )); } -abstract class _PlayerState extends PlayerState { - const factory _PlayerState( - {required final String playerId, - final MediaItem? currentMediaItem, - final VideoSize? videoSize, - final int? playbackPositionMs, - final double playbackSpeed, - final bool isNativeFullscreen, - final PlaybackState playbackState, - final bool isBuffering, - final bool isInPipMode, - final bool isInitialized, - final int? textureId, - final double? volume, - final PlayerError? error}) = _$PlayerStateImpl; - const _PlayerState._() : super._(); - - @override - String get playerId; - @override - MediaItem? get currentMediaItem; - @override - VideoSize? get videoSize; - @override - int? get playbackPositionMs; - @override - double get playbackSpeed; - @override - bool get isNativeFullscreen; - @override - PlaybackState get playbackState; - @override - bool get isBuffering; - @override - bool get isInPipMode; - @override - bool get isInitialized; - @override - int? get textureId; - @override - double? get volume; - @override - PlayerError? get error; - - /// Create a copy of PlayerState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PlayerStateImplCopyWith<_$PlayerStateImpl> get copyWith => - throw _privateConstructorUsedError; + } + +// dart format on diff --git a/lib/src/state/plugin_state_notifier.freezed.dart b/lib/src/state/plugin_state_notifier.freezed.dart index edbae9b..a698dd0 100644 --- a/lib/src/state/plugin_state_notifier.freezed.dart +++ b/lib/src/state/plugin_state_notifier.freezed.dart @@ -1,6 +1,6 @@ -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint +// coverage:ignore-file +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'plugin_state_notifier.dart'; @@ -9,168 +9,280 @@ part of 'plugin_state_notifier.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$PlayerPluginState { - String? get primaryPlayerId => throw _privateConstructorUsedError; - Map get players => - throw _privateConstructorUsedError; - /// Create a copy of PlayerPluginState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PlayerPluginStateCopyWith get copyWith => - throw _privateConstructorUsedError; + String? get primaryPlayerId; Map get players; +/// Create a copy of PlayerPluginState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PlayerPluginStateCopyWith get copyWith => _$PlayerPluginStateCopyWithImpl(this as PlayerPluginState, _$identity); + + + +@override +bool operator ==(Object other) { + final _this = this as PlayerPluginState; + return identical(this, other) || (other.runtimeType == runtimeType&&other is PlayerPluginState&&(identical(other.primaryPlayerId, _this.primaryPlayerId) || other.primaryPlayerId == _this.primaryPlayerId)&&const DeepCollectionEquality().equals(other.players, _this.players)); } -/// @nodoc -abstract class $PlayerPluginStateCopyWith<$Res> { - factory $PlayerPluginStateCopyWith( - PlayerPluginState value, $Res Function(PlayerPluginState) then) = - _$PlayerPluginStateCopyWithImpl<$Res, PlayerPluginState>; - @useResult - $Res call( - {String? primaryPlayerId, Map players}); + +@override +int get hashCode { + final _this = this as PlayerPluginState; + return Object.hash(runtimeType,_this.primaryPlayerId,const DeepCollectionEquality().hash(_this.players)); } -/// @nodoc -class _$PlayerPluginStateCopyWithImpl<$Res, $Val extends PlayerPluginState> - implements $PlayerPluginStateCopyWith<$Res> { - _$PlayerPluginStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PlayerPluginState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? primaryPlayerId = freezed, - Object? players = null, - }) { - return _then(_value.copyWith( - primaryPlayerId: freezed == primaryPlayerId - ? _value.primaryPlayerId - : primaryPlayerId // ignore: cast_nullable_to_non_nullable - as String?, - players: null == players - ? _value.players - : players // ignore: cast_nullable_to_non_nullable - as Map, - ) as $Val); - } +@override +String toString() { + final _this = this as PlayerPluginState; + return 'PlayerPluginState(primaryPlayerId: ${_this.primaryPlayerId}, players: ${_this.players})'; } + +} + +/// @nodoc +abstract mixin class $PlayerPluginStateCopyWith<$Res> { + factory $PlayerPluginStateCopyWith(PlayerPluginState value, $Res Function(PlayerPluginState) _then) = _$PlayerPluginStateCopyWithImpl; +@useResult +$Res call({ + String? primaryPlayerId, Map players +}); + + + + +} /// @nodoc -abstract class _$$PlayerPluginStateImplCopyWith<$Res> +class _$PlayerPluginStateCopyWithImpl<$Res> implements $PlayerPluginStateCopyWith<$Res> { - factory _$$PlayerPluginStateImplCopyWith(_$PlayerPluginStateImpl value, - $Res Function(_$PlayerPluginStateImpl) then) = - __$$PlayerPluginStateImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? primaryPlayerId, Map players}); + _$PlayerPluginStateCopyWithImpl(this._self, this._then); + + final PlayerPluginState _self; + final $Res Function(PlayerPluginState) _then; + +/// Create a copy of PlayerPluginState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? primaryPlayerId = freezed,Object? players = null,}) { + return _then(PlayerPluginState( +primaryPlayerId: freezed == primaryPlayerId ? _self.primaryPlayerId : primaryPlayerId // ignore: cast_nullable_to_non_nullable +as String?,players: null == players ? _self.players : players // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + +} + + +/// Adds pattern-matching-related methods to [PlayerPluginState]. +extension PlayerPluginStatePatterns on PlayerPluginState { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _PlayerPluginState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PlayerPluginState() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _PlayerPluginState value) $default,){ +final _that = this; +switch (_that) { +case _PlayerPluginState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _PlayerPluginState value)? $default,){ +final _that = this; +switch (_that) { +case _PlayerPluginState() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String? primaryPlayerId, Map players)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PlayerPluginState() when $default != null: +return $default(_that.primaryPlayerId,_that.players);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String? primaryPlayerId, Map players) $default,) {final _that = this; +switch (_that) { +case _PlayerPluginState(): +return $default(_that.primaryPlayerId,_that.players);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? primaryPlayerId, Map players)? $default,) {final _that = this; +switch (_that) { +case _PlayerPluginState() when $default != null: +return $default(_that.primaryPlayerId,_that.players);case _: + return null; + +} } -/// @nodoc -class __$$PlayerPluginStateImplCopyWithImpl<$Res> - extends _$PlayerPluginStateCopyWithImpl<$Res, _$PlayerPluginStateImpl> - implements _$$PlayerPluginStateImplCopyWith<$Res> { - __$$PlayerPluginStateImplCopyWithImpl(_$PlayerPluginStateImpl _value, - $Res Function(_$PlayerPluginStateImpl) _then) - : super(_value, _then); - - /// Create a copy of PlayerPluginState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? primaryPlayerId = freezed, - Object? players = null, - }) { - return _then(_$PlayerPluginStateImpl( - primaryPlayerId: freezed == primaryPlayerId - ? _value.primaryPlayerId - : primaryPlayerId // ignore: cast_nullable_to_non_nullable - as String?, - players: null == players - ? _value._players - : players // ignore: cast_nullable_to_non_nullable - as Map, - )); - } } /// @nodoc -class _$PlayerPluginStateImpl implements _PlayerPluginState { - const _$PlayerPluginStateImpl( - {required this.primaryPlayerId, - required final Map players}) - : _players = players; - - @override - final String? primaryPlayerId; - final Map _players; - @override - Map get players { - if (_players is EqualUnmodifiableMapView) return _players; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_players); - } - - @override - String toString() { + +class _PlayerPluginState implements PlayerPluginState { + const _PlayerPluginState({required this.primaryPlayerId, required Map players}): _players = players; + + +@override final String? primaryPlayerId; + final Map _players; +@override Map get players { + if (_players is EqualUnmodifiableMapView) return _players; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_players); +} + + +/// Create a copy of PlayerPluginState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PlayerPluginStateCopyWith<_PlayerPluginState> get copyWith => __$PlayerPluginStateCopyWithImpl<_PlayerPluginState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PlayerPluginState&&(identical(other.primaryPlayerId, primaryPlayerId) || other.primaryPlayerId == primaryPlayerId)&&const DeepCollectionEquality().equals(other.players, _players)); +} + + +@override +int get hashCode { + return Object.hash(runtimeType,primaryPlayerId,const DeepCollectionEquality().hash(_players)); +} + +@override +String toString() { return 'PlayerPluginState(primaryPlayerId: $primaryPlayerId, players: $players)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PlayerPluginStateImpl && - (identical(other.primaryPlayerId, primaryPlayerId) || - other.primaryPlayerId == primaryPlayerId) && - const DeepCollectionEquality().equals(other._players, _players)); - } - - @override - int get hashCode => Object.hash(runtimeType, primaryPlayerId, - const DeepCollectionEquality().hash(_players)); - - /// Create a copy of PlayerPluginState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PlayerPluginStateImplCopyWith<_$PlayerPluginStateImpl> get copyWith => - __$$PlayerPluginStateImplCopyWithImpl<_$PlayerPluginStateImpl>( - this, _$identity); -} - -abstract class _PlayerPluginState implements PlayerPluginState { - const factory _PlayerPluginState( - {required final String? primaryPlayerId, - required final Map players}) = - _$PlayerPluginStateImpl; - - @override - String? get primaryPlayerId; - @override - Map get players; - - /// Create a copy of PlayerPluginState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PlayerPluginStateImplCopyWith<_$PlayerPluginStateImpl> get copyWith => - throw _privateConstructorUsedError; } + + +} + +/// @nodoc +abstract mixin class _$PlayerPluginStateCopyWith<$Res> implements $PlayerPluginStateCopyWith<$Res> { + factory _$PlayerPluginStateCopyWith(_PlayerPluginState value, $Res Function(_PlayerPluginState) _then) = __$PlayerPluginStateCopyWithImpl; +@override @useResult +$Res call({ + String? primaryPlayerId, Map players +}); + + + + +} +/// @nodoc +class __$PlayerPluginStateCopyWithImpl<$Res> + implements _$PlayerPluginStateCopyWith<$Res> { + __$PlayerPluginStateCopyWithImpl(this._self, this._then); + + final _PlayerPluginState _self; + final $Res Function(_PlayerPluginState) _then; + +/// Create a copy of PlayerPluginState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? primaryPlayerId = freezed,Object? players = null,}) { + return _then(_PlayerPluginState( +primaryPlayerId: freezed == primaryPlayerId ? _self.primaryPlayerId : primaryPlayerId // ignore: cast_nullable_to_non_nullable +as String?,players: null == players ? _self._players : players // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/pubspec.yaml b/pubspec.yaml index b4dfdc9..9a710cb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,12 +1,12 @@ name: bccm_player description: ExoPlayer/AVPlayer via platform views, with cast, PiP, background audio, audio selection, etc. -version: 1.3.1 +version: 2.0.0 documentation: https://bcc-code.github.io/bccm-player/ repository: https://github.com/bcc-code/bccm-player environment: - sdk: ">=3.12.0 <4.0.0" - flutter: ">=3.44.0" + sdk: ">=3.13.0 <4.0.0" + flutter: ">=3.47.0" dependencies: collection: ^1.17.1 @@ -18,8 +18,7 @@ dependencies: flutter_svg: ^2.0.2 flutter_web_plugins: sdk: flutter - freezed: ^2.3.2 - freezed_annotation: ^2.2.0 + freezed_annotation: ^3.1.0 js: ^0.7.1 meta: ^1.9.1 plugin_platform_interface: ^2.0.2 @@ -33,9 +32,10 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^4.0.0 - pigeon: ^22.3.0 - build_runner: ^2.3.3 - mockito: ^5.4.2 + pigeon: ^28.0.0 + build_runner: ^2.16.0 + freezed: ^4.0.1 + mockito: ^5.8.1 # Explicit rather than transitive via flutter_test: the timer-based tests # (Debouncer, OneAsyncAtATime, the position ticker) depend on it directly. fake_async: ^1.3.3 diff --git a/test/utils/mocks.dart b/test/utils/mocks.dart index 8845349..3d7b539 100644 --- a/test/utils/mocks.dart +++ b/test/utils/mocks.dart @@ -6,6 +6,10 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart'; // ignore: deprecated_member_use MockSpec(mixingIn: [MockPlatformInterfaceMixin]), MockSpec(), - MockSpec(), + // PlayerStateNotifier is deliberately not mocked. Its `state`/`debugState`/`getState` + // return a non-nullable PlayerState, so mockito synthesises a `SmartFake` for it — and + // since freezed 4 puts DiagnosticableTreeMixin on the generated mixin, PlayerState's + // interface requires `toString({DiagnosticLevel minLevel})`, which SmartFake cannot + // satisfy. The mock was unused, so the spec is simply dropped. ]) export 'mocks.mocks.dart'; diff --git a/test/utils/mocks.mocks.dart b/test/utils/mocks.mocks.dart index 1409752..19537d6 100644 --- a/test/utils/mocks.mocks.dart +++ b/test/utils/mocks.mocks.dart @@ -1,18 +1,18 @@ -// Mocks generated by Mockito 5.4.6 from annotations +// Mocks generated by Mockito from annotations // in bccm_player/test/utils/mocks.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i3; + +import 'dart:async' as _i4; import 'package:bccm_player/bccm_player.dart' as _i2; -import 'package:bccm_player/src/pigeon/playback_platform_pigeon.g.dart' as _i7; -import 'package:bccm_player/src/queue/queue_controller.dart' as _i4; +import 'package:bccm_player/src/pigeon/playback_platform_pigeon.g.dart' as _i6; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i6; +import 'package:mockito/src/dummies.dart' as _i5; import 'package:plugin_platform_interface/plugin_platform_interface.dart' - as _i5; -import 'package:state_notifier/state_notifier.dart' as _i8; + as _i3; +import 'package:state_notifier/state_notifier.dart' as _i7; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -20,6 +20,7 @@ import 'package:state_notifier/state_notifier.dart' as _i8; // ignore_for_file: comment_references // ignore_for_file: deprecated_member_use // ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: experimental_member_use // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: must_be_immutable @@ -27,573 +28,373 @@ import 'package:state_notifier/state_notifier.dart' as _i8; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class +// ignore_for_file: invalid_use_of_internal_member class _FakePlayerPluginStateNotifier_0 extends _i1.SmartFake implements _i2.PlayerPluginStateNotifier { - _FakePlayerPluginStateNotifier_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePlayerPluginStateNotifier_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBccmPlayerController_1 extends _i1.SmartFake implements _i2.BccmPlayerController { - _FakeBccmPlayerController_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeBccmPlayerController_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMediaInfo_2 extends _i1.SmartFake implements _i2.MediaInfo { - _FakeMediaInfo_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeMediaInfo_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakePlayerPluginState_3 extends _i1.SmartFake implements _i2.PlayerPluginState { - _FakePlayerPluginState_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePlayerPluginState_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakePlayerStateNotifier_4 extends _i1.SmartFake implements _i2.PlayerStateNotifier { - _FakePlayerStateNotifier_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTimer_5 extends _i1.SmartFake implements _i3.Timer { - _FakeTimer_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeQueueManager_6 extends _i1.SmartFake implements _i4.QueueManager { - _FakeQueueManager_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakePlayerState_7 extends _i1.SmartFake implements _i2.PlayerState { - _FakePlayerState_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePlayerStateNotifier_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [BccmPlayerInterface]. /// /// See the documentation for Mockito's code generation for more information. class MockBccmPlayerInterface extends _i1.Mock - with _i5.MockPlatformInterfaceMixin + with _i3.MockPlatformInterfaceMixin implements _i2.BccmPlayerInterface { @override _i2.PlayerPluginStateNotifier get stateNotifier => (super.noSuchMethod( - Invocation.getter(#stateNotifier), - returnValue: _FakePlayerPluginStateNotifier_0( - this, - Invocation.getter(#stateNotifier), - ), - returnValueForMissingStub: _FakePlayerPluginStateNotifier_0( - this, - Invocation.getter(#stateNotifier), - ), - ) as _i2.PlayerPluginStateNotifier); - - @override - _i3.Stream<_i2.ChromecastEvent> get chromecastEventStream => + Invocation.getter(#stateNotifier), + returnValue: _FakePlayerPluginStateNotifier_0( + this, + Invocation.getter(#stateNotifier), + ), + returnValueForMissingStub: _FakePlayerPluginStateNotifier_0( + this, + Invocation.getter(#stateNotifier), + ), + ) as _i2.PlayerPluginStateNotifier); + + @override + _i4.Stream<_i2.ChromecastEvent> get chromecastEventStream => (super.noSuchMethod( Invocation.getter(#chromecastEventStream), - returnValue: _i3.Stream<_i2.ChromecastEvent>.empty(), - returnValueForMissingStub: _i3.Stream<_i2.ChromecastEvent>.empty(), - ) as _i3.Stream<_i2.ChromecastEvent>); + returnValue: _i4.Stream<_i2.ChromecastEvent>.empty(), + returnValueForMissingStub: _i4.Stream<_i2.ChromecastEvent>.empty(), + ) as _i4.Stream<_i2.ChromecastEvent>); @override - _i3.Stream get playerEventStream => (super.noSuchMethod( - Invocation.getter(#playerEventStream), - returnValue: _i3.Stream.empty(), - returnValueForMissingStub: _i3.Stream.empty(), - ) as _i3.Stream); + _i4.Stream get playerEventStream => (super.noSuchMethod( + Invocation.getter(#playerEventStream), + returnValue: _i4.Stream.empty(), + returnValueForMissingStub: _i4.Stream.empty(), + ) as _i4.Stream); @override _i2.BccmPlayerController get primaryController => (super.noSuchMethod( - Invocation.getter(#primaryController), - returnValue: _FakeBccmPlayerController_1( - this, - Invocation.getter(#primaryController), - ), - returnValueForMissingStub: _FakeBccmPlayerController_1( - this, - Invocation.getter(#primaryController), - ), - ) as _i2.BccmPlayerController); - - @override - _i3.Future setup() => (super.noSuchMethod( - Invocation.method( - #setup, - [], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - - @override - _i3.Future newPlayer({ + Invocation.getter(#primaryController), + returnValue: _FakeBccmPlayerController_1( + this, + Invocation.getter(#primaryController), + ), + returnValueForMissingStub: _FakeBccmPlayerController_1( + this, + Invocation.getter(#primaryController), + ), + ) as _i2.BccmPlayerController); + + @override + _i4.Future setup() => (super.noSuchMethod( + Invocation.method(#setup, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future newPlayer({ _i2.BufferMode? bufferMode, bool? disableNpaw, - }) => - (super.noSuchMethod( - Invocation.method( - #newPlayer, - [], - { - #bufferMode: bufferMode, - #disableNpaw: disableNpaw, - }, - ), - returnValue: _i3.Future.value(_i6.dummyValue( - this, - Invocation.method( - #newPlayer, - [], - { - #bufferMode: bufferMode, - #disableNpaw: disableNpaw, - }, - ), - )), - returnValueForMissingStub: - _i3.Future.value(_i6.dummyValue( - this, - Invocation.method( - #newPlayer, - [], - { - #bufferMode: bufferMode, - #disableNpaw: disableNpaw, - }, - ), - )), - ) as _i3.Future); - - @override - _i3.Future disposePlayer(String? playerId) => (super.noSuchMethod( - Invocation.method( - #disposePlayer, - [playerId], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - - @override - _i3.Future setPrimary(String? id) => (super.noSuchMethod( - Invocation.method( - #setPrimary, - [id], - ), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future replaceCurrentMediaItem( + }) => (super.noSuchMethod( + Invocation.method(#newPlayer, [], { + #bufferMode: bufferMode, + #disableNpaw: disableNpaw, + }), + returnValue: _i4.Future.value( + _i5.dummyValue( + this, + Invocation.method(#newPlayer, [], { + #bufferMode: bufferMode, + #disableNpaw: disableNpaw, + }), + ), + ), + returnValueForMissingStub: _i4.Future.value( + _i5.dummyValue( + this, + Invocation.method(#newPlayer, [], { + #bufferMode: bufferMode, + #disableNpaw: disableNpaw, + }), + ), + ), + ) as _i4.Future); + + @override + _i4.Future disposePlayer(String? playerId) => (super.noSuchMethod( + Invocation.method(#disposePlayer, [playerId]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future setPrimary(String? id) => (super.noSuchMethod( + Invocation.method(#setPrimary, [id]), + returnValue: _i4.Future.value(false), + returnValueForMissingStub: _i4.Future.value(false), + ) as _i4.Future); + + @override + _i4.Future replaceCurrentMediaItem( String? playerId, _i2.MediaItem? mediaItem, { bool? playbackPositionFromPrimary, bool? autoplay = true, - }) => - (super.noSuchMethod( - Invocation.method( - #replaceCurrentMediaItem, - [ - playerId, - mediaItem, - ], - { - #playbackPositionFromPrimary: playbackPositionFromPrimary, - #autoplay: autoplay, - }, - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - - @override - _i3.Future<_i7.ChromecastState?> getChromecastState() => (super.noSuchMethod( - Invocation.method( - #getChromecastState, - [], - ), - returnValue: _i3.Future<_i7.ChromecastState?>.value(), - returnValueForMissingStub: _i3.Future<_i7.ChromecastState?>.value(), - ) as _i3.Future<_i7.ChromecastState?>); - - @override - _i3.Future<_i2.PlayerTracksSnapshot?> getPlayerTracks({String? playerId}) => + }) => (super.noSuchMethod( + Invocation.method( + #replaceCurrentMediaItem, + [playerId, mediaItem], + { + #playbackPositionFromPrimary: playbackPositionFromPrimary, + #autoplay: autoplay, + }, + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future<_i6.ChromecastState?> getChromecastState() => (super.noSuchMethod( + Invocation.method(#getChromecastState, []), + returnValue: _i4.Future<_i6.ChromecastState?>.value(), + returnValueForMissingStub: _i4.Future<_i6.ChromecastState?>.value(), + ) as _i4.Future<_i6.ChromecastState?>); + + @override + _i4.Future<_i2.PlayerTracksSnapshot?> getPlayerTracks({String? playerId}) => (super.noSuchMethod( - Invocation.method( - #getPlayerTracks, - [], - {#playerId: playerId}, - ), - returnValue: _i3.Future<_i2.PlayerTracksSnapshot?>.value(), + Invocation.method(#getPlayerTracks, [], {#playerId: playerId}), + returnValue: _i4.Future<_i2.PlayerTracksSnapshot?>.value(), returnValueForMissingStub: - _i3.Future<_i2.PlayerTracksSnapshot?>.value(), - ) as _i3.Future<_i2.PlayerTracksSnapshot?>); + _i4.Future<_i2.PlayerTracksSnapshot?>.value(), + ) as _i4.Future<_i2.PlayerTracksSnapshot?>); @override - _i3.Future<_i7.PlayerStateSnapshot?> getPlayerState({String? playerId}) => + _i4.Future<_i6.PlayerStateSnapshot?> getPlayerState({String? playerId}) => (super.noSuchMethod( - Invocation.method( - #getPlayerState, - [], - {#playerId: playerId}, - ), - returnValue: _i3.Future<_i7.PlayerStateSnapshot?>.value(), - returnValueForMissingStub: _i3.Future<_i7.PlayerStateSnapshot?>.value(), - ) as _i3.Future<_i7.PlayerStateSnapshot?>); + Invocation.method(#getPlayerState, [], {#playerId: playerId}), + returnValue: _i4.Future<_i6.PlayerStateSnapshot?>.value(), + returnValueForMissingStub: _i4.Future<_i6.PlayerStateSnapshot?>.value(), + ) as _i4.Future<_i6.PlayerStateSnapshot?>); @override void openExpandedCastController() => super.noSuchMethod( - Invocation.method( - #openExpandedCastController, - [], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#openExpandedCastController, []), + returnValueForMissingStub: null, + ); @override void openCastDialog() => super.noSuchMethod( - Invocation.method( - #openCastDialog, - [], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#openCastDialog, []), + returnValueForMissingStub: null, + ); @override - _i3.Future addPlaybackListener(_i7.PlaybackListenerPigeon? listener) => + _i4.Future addPlaybackListener(_i6.PlaybackListenerPigeon? listener) => (super.noSuchMethod( - Invocation.method( - #addPlaybackListener, - [listener], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#addPlaybackListener, [listener]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i3.Future removePlaybackListener( - _i7.PlaybackListenerPigeon? listener) => - (super.noSuchMethod( - Invocation.method( - #removePlaybackListener, - [listener], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i4.Future removePlaybackListener( + _i6.PlaybackListenerPigeon? listener, + ) => (super.noSuchMethod( + Invocation.method(#removePlaybackListener, [listener]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override void play(String? playerId) => super.noSuchMethod( - Invocation.method( - #play, - [playerId], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#play, [playerId]), + returnValueForMissingStub: null, + ); @override - _i3.Future seekTo( - String? playerId, - double? positionMs, - ) => + _i4.Future seekTo(String? playerId, double? positionMs) => (super.noSuchMethod( - Invocation.method( - #seekTo, - [ - playerId, - positionMs, - ], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#seekTo, [playerId, positionMs]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future seekToLive(String? playerId) => (super.noSuchMethod( + Invocation.method(#seekToLive, [playerId]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override void pause(String? playerId) => super.noSuchMethod( - Invocation.method( - #pause, - [playerId], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#pause, [playerId]), + returnValueForMissingStub: null, + ); @override - void stop( - String? playerId, - bool? reset, - ) => - super.noSuchMethod( - Invocation.method( - #stop, - [ - playerId, - reset, - ], - ), - returnValueForMissingStub: null, - ); + void stop(String? playerId, bool? reset) => super.noSuchMethod( + Invocation.method(#stop, [playerId, reset]), + returnValueForMissingStub: null, + ); @override - _i3.Future setSelectedTrack( + _i4.Future setSelectedTrack( String? playerId, _i2.TrackType? type, String? trackId, - ) => - (super.noSuchMethod( - Invocation.method( - #setSelectedTrack, - [ - playerId, - type, - trackId, - ], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + ) => (super.noSuchMethod( + Invocation.method(#setSelectedTrack, [playerId, type, trackId]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i3.Future setPlaybackSpeed( - String? playerId, - double? speed, - ) => + _i4.Future setPlaybackSpeed(String? playerId, double? speed) => (super.noSuchMethod( - Invocation.method( - #setPlaybackSpeed, - [ - playerId, - speed, - ], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setPlaybackSpeed, [playerId, speed]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i3.Future setVolume( - String? playerId, - double? volume, - ) => + _i4.Future setVolume(String? playerId, double? volume) => (super.noSuchMethod( - Invocation.method( - #setVolume, - [ - playerId, - volume, - ], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setVolume, [playerId, volume]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override void exitFullscreen(String? playerId) => super.noSuchMethod( - Invocation.method( - #exitFullscreen, - [playerId], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#exitFullscreen, [playerId]), + returnValueForMissingStub: null, + ); @override - _i3.Future enterFullscreen(String? playerId) => (super.noSuchMethod( - Invocation.method( - #enterFullscreen, - [playerId], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i4.Future enterFullscreen(String? playerId) => (super.noSuchMethod( + Invocation.method(#enterFullscreen, [playerId]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future? startNpawView( + String? playerId, + _i2.MediaMetadata? metadata, + ) => (super.noSuchMethod( + Invocation.method(#startNpawView, [playerId, metadata]), + returnValueForMissingStub: null, + ) as _i4.Future?); @override void setAppConfig(_i2.AppConfig? config) => super.noSuchMethod( - Invocation.method( - #setAppConfig, - [config], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#setAppConfig, [config]), + returnValueForMissingStub: null, + ); @override - void setPlayerViewVisibility( - int? viewId, - bool? visible, - ) => + void setPlayerViewVisibility(int? viewId, bool? visible) => super.noSuchMethod( - Invocation.method( - #setPlayerViewVisibility, - [ - viewId, - visible, - ], - ), + Invocation.method(#setPlayerViewVisibility, [viewId, visible]), returnValueForMissingStub: null, ); @override - _i3.Future setMixWithOthers( - String? playerId, - bool? mixWithOthers, - ) => + _i4.Future setMixWithOthers(String? playerId, bool? mixWithOthers) => (super.noSuchMethod( - Invocation.method( - #setMixWithOthers, - [ - playerId, - mixWithOthers, - ], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setMixWithOthers, [playerId, mixWithOthers]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i3.Future createVideoTexture() => (super.noSuchMethod( - Invocation.method( - #createVideoTexture, - [], - ), - returnValue: _i3.Future.value(0), - returnValueForMissingStub: _i3.Future.value(0), - ) as _i3.Future); + _i4.Future createVideoTexture() => (super.noSuchMethod( + Invocation.method(#createVideoTexture, []), + returnValue: _i4.Future.value(0), + returnValueForMissingStub: _i4.Future.value(0), + ) as _i4.Future); @override - _i3.Future disposeVideoTexture(int? textureId) => (super.noSuchMethod( - Invocation.method( - #disposeVideoTexture, - [textureId], - ), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) as _i3.Future); + _i4.Future disposeVideoTexture(int? textureId) => (super.noSuchMethod( + Invocation.method(#disposeVideoTexture, [textureId]), + returnValue: _i4.Future.value(false), + returnValueForMissingStub: _i4.Future.value(false), + ) as _i4.Future); @override - _i3.Future switchToVideoTexture( - String? playerId, - int? textureId, - ) => + _i4.Future switchToVideoTexture(String? playerId, int? textureId) => (super.noSuchMethod( - Invocation.method( - #switchToVideoTexture, - [ - playerId, - textureId, - ], - ), - returnValue: _i3.Future.value(0), - returnValueForMissingStub: _i3.Future.value(0), - ) as _i3.Future); + Invocation.method(#switchToVideoTexture, [playerId, textureId]), + returnValue: _i4.Future.value(0), + returnValueForMissingStub: _i4.Future.value(0), + ) as _i4.Future); @override - _i3.Future<_i2.MediaInfo> fetchMediaInfo({ + _i4.Future<_i2.MediaInfo> fetchMediaInfo({ required String? url, String? mimeType, - }) => - (super.noSuchMethod( - Invocation.method( - #fetchMediaInfo, - [], - { - #url: url, - #mimeType: mimeType, - }, - ), - returnValue: _i3.Future<_i2.MediaInfo>.value(_FakeMediaInfo_2( - this, - Invocation.method( - #fetchMediaInfo, - [], - { - #url: url, - #mimeType: mimeType, - }, - ), - )), - returnValueForMissingStub: - _i3.Future<_i2.MediaInfo>.value(_FakeMediaInfo_2( - this, - Invocation.method( - #fetchMediaInfo, - [], - { - #url: url, - #mimeType: mimeType, - }, - ), - )), - ) as _i3.Future<_i2.MediaInfo>); - - @override - _i3.Future setRepeatMode( + }) => (super.noSuchMethod( + Invocation.method(#fetchMediaInfo, [], {#url: url, #mimeType: mimeType}), + returnValue: _i4.Future<_i2.MediaInfo>.value( + _FakeMediaInfo_2( + this, + Invocation.method(#fetchMediaInfo, [], { + #url: url, + #mimeType: mimeType, + }), + ), + ), + returnValueForMissingStub: _i4.Future<_i2.MediaInfo>.value( + _FakeMediaInfo_2( + this, + Invocation.method(#fetchMediaInfo, [], { + #url: url, + #mimeType: mimeType, + }), + ), + ), + ) as _i4.Future<_i2.MediaInfo>); + + @override + _i4.Future setRepeatMode( String? playerId, _i2.RepeatMode? repeatMode, - ) => - (super.noSuchMethod( - Invocation.method( - #setRepeatMode, - [ - playerId, - repeatMode, - ], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - - @override - _i3.Future getAndroidPerformanceClass() => (super.noSuchMethod( - Invocation.method( - #getAndroidPerformanceClass, - [], - ), - returnValue: _i3.Future.value(0), - returnValueForMissingStub: _i3.Future.value(0), - ) as _i3.Future); + ) => (super.noSuchMethod( + Invocation.method(#setRepeatMode, [playerId, repeatMode]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future getAndroidPerformanceClass() => (super.noSuchMethod( + Invocation.method(#getAndroidPerformanceClass, []), + returnValue: _i4.Future.value(0), + returnValueForMissingStub: _i4.Future.value(0), + ) as _i4.Future); } /// A class which mocks [PlayerPluginStateNotifier]. @@ -603,125 +404,94 @@ class MockPlayerPluginStateNotifier extends _i1.Mock implements _i2.PlayerPluginStateNotifier { @override bool get keepAlive => (super.noSuchMethod( - Invocation.getter(#keepAlive), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); + Invocation.getter(#keepAlive), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); @override bool get mounted => (super.noSuchMethod( - Invocation.getter(#mounted), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); + Invocation.getter(#mounted), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); @override - _i3.Stream<_i2.PlayerPluginState> get stream => (super.noSuchMethod( - Invocation.getter(#stream), - returnValue: _i3.Stream<_i2.PlayerPluginState>.empty(), - returnValueForMissingStub: _i3.Stream<_i2.PlayerPluginState>.empty(), - ) as _i3.Stream<_i2.PlayerPluginState>); + _i4.Stream<_i2.PlayerPluginState> get stream => (super.noSuchMethod( + Invocation.getter(#stream), + returnValue: _i4.Stream<_i2.PlayerPluginState>.empty(), + returnValueForMissingStub: _i4.Stream<_i2.PlayerPluginState>.empty(), + ) as _i4.Stream<_i2.PlayerPluginState>); @override _i2.PlayerPluginState get state => (super.noSuchMethod( - Invocation.getter(#state), - returnValue: _FakePlayerPluginState_3( - this, - Invocation.getter(#state), - ), - returnValueForMissingStub: _FakePlayerPluginState_3( - this, - Invocation.getter(#state), - ), - ) as _i2.PlayerPluginState); + Invocation.getter(#state), + returnValue: _FakePlayerPluginState_3(this, Invocation.getter(#state)), + returnValueForMissingStub: _FakePlayerPluginState_3( + this, + Invocation.getter(#state), + ), + ) as _i2.PlayerPluginState); @override _i2.PlayerPluginState get debugState => (super.noSuchMethod( - Invocation.getter(#debugState), - returnValue: _FakePlayerPluginState_3( - this, - Invocation.getter(#debugState), - ), - returnValueForMissingStub: _FakePlayerPluginState_3( - this, - Invocation.getter(#debugState), - ), - ) as _i2.PlayerPluginState); + Invocation.getter(#debugState), + returnValue: _FakePlayerPluginState_3(this, Invocation.getter(#debugState)), + returnValueForMissingStub: _FakePlayerPluginState_3( + this, + Invocation.getter(#debugState), + ), + ) as _i2.PlayerPluginState); @override bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); @override - set onError(_i8.ErrorListener? _onError) => super.noSuchMethod( - Invocation.setter( - #onError, - _onError, - ), - returnValueForMissingStub: null, - ); + set onError(_i7.ErrorListener? value) => super.noSuchMethod( + Invocation.setter(#onError, value), + returnValueForMissingStub: null, + ); @override set state(_i2.PlayerPluginState? value) => super.noSuchMethod( - Invocation.setter( - #state, - value, - ), - returnValueForMissingStub: null, - ); + Invocation.setter(#state, value), + returnValueForMissingStub: null, + ); @override void dispose({bool? force}) => super.noSuchMethod( - Invocation.method( - #dispose, - [], - {#force: force}, - ), - returnValueForMissingStub: null, - ); + Invocation.method(#dispose, [], {#force: force}), + returnValueForMissingStub: null, + ); @override void setPrimaryPlayer(String? playerId) => super.noSuchMethod( - Invocation.method( - #setPrimaryPlayer, - [playerId], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#setPrimaryPlayer, [playerId]), + returnValueForMissingStub: null, + ); @override _i2.PlayerStateNotifier? getPlayerNotifier(String? playerId) => (super.noSuchMethod( - Invocation.method( - #getPlayerNotifier, - [playerId], - ), + Invocation.method(#getPlayerNotifier, [playerId]), returnValueForMissingStub: null, ) as _i2.PlayerStateNotifier?); @override _i2.PlayerStateNotifier getOrAddPlayerNotifier(String? playerId) => (super.noSuchMethod( - Invocation.method( - #getOrAddPlayerNotifier, - [playerId], - ), + Invocation.method(#getOrAddPlayerNotifier, [playerId]), returnValue: _FakePlayerStateNotifier_4( this, - Invocation.method( - #getOrAddPlayerNotifier, - [playerId], - ), + Invocation.method(#getOrAddPlayerNotifier, [playerId]), ), returnValueForMissingStub: _FakePlayerStateNotifier_4( this, - Invocation.method( - #getOrAddPlayerNotifier, - [playerId], - ), + Invocation.method(#getOrAddPlayerNotifier, [playerId]), ), ) as _i2.PlayerStateNotifier); @@ -729,291 +499,23 @@ class MockPlayerPluginStateNotifier extends _i1.Mock bool updateShouldNotify( _i2.PlayerPluginState? old, _i2.PlayerPluginState? current, - ) => - (super.noSuchMethod( - Invocation.method( - #updateShouldNotify, - [ - old, - current, - ], - ), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); + ) => (super.noSuchMethod( + Invocation.method(#updateShouldNotify, [old, current]), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); @override - _i8.RemoveListener addListener( - _i8.Listener<_i2.PlayerPluginState>? listener, { + _i7.RemoveListener addListener( + _i7.Listener<_i2.PlayerPluginState>? listener, { bool? fireImmediately = true, - }) => - (super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - {#fireImmediately: fireImmediately}, - ), - returnValue: () {}, - returnValueForMissingStub: () {}, - ) as _i8.RemoveListener); -} - -/// A class which mocks [PlayerStateNotifier]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPlayerStateNotifier extends _i1.Mock - implements _i2.PlayerStateNotifier { - @override - bool get keepAlive => (super.noSuchMethod( - Invocation.getter(#keepAlive), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); - - @override - _i3.Timer get positionUpdateTimer => (super.noSuchMethod( - Invocation.getter(#positionUpdateTimer), - returnValue: _FakeTimer_5( - this, - Invocation.getter(#positionUpdateTimer), - ), - returnValueForMissingStub: _FakeTimer_5( - this, - Invocation.getter(#positionUpdateTimer), - ), - ) as _i3.Timer); - - @override - _i4.QueueManager get queueManager => (super.noSuchMethod( - Invocation.getter(#queueManager), - returnValue: _FakeQueueManager_6( - this, - Invocation.getter(#queueManager), - ), - returnValueForMissingStub: _FakeQueueManager_6( - this, - Invocation.getter(#queueManager), - ), - ) as _i4.QueueManager); - - @override - set positionUpdateTimer(_i3.Timer? _positionUpdateTimer) => - super.noSuchMethod( - Invocation.setter( - #positionUpdateTimer, - _positionUpdateTimer, - ), - returnValueForMissingStub: null, - ); - - @override - set queueManager(_i4.QueueManager? _queueManager) => super.noSuchMethod( - Invocation.setter( - #queueManager, - _queueManager, - ), - returnValueForMissingStub: null, - ); - - @override - bool get mounted => (super.noSuchMethod( - Invocation.getter(#mounted), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); - - @override - _i3.Stream<_i2.PlayerState> get stream => (super.noSuchMethod( - Invocation.getter(#stream), - returnValue: _i3.Stream<_i2.PlayerState>.empty(), - returnValueForMissingStub: _i3.Stream<_i2.PlayerState>.empty(), - ) as _i3.Stream<_i2.PlayerState>); - - @override - _i2.PlayerState get state => (super.noSuchMethod( - Invocation.getter(#state), - returnValue: _FakePlayerState_7( - this, - Invocation.getter(#state), - ), - returnValueForMissingStub: _FakePlayerState_7( - this, - Invocation.getter(#state), - ), - ) as _i2.PlayerState); - - @override - _i2.PlayerState get debugState => (super.noSuchMethod( - Invocation.getter(#debugState), - returnValue: _FakePlayerState_7( - this, - Invocation.getter(#debugState), - ), - returnValueForMissingStub: _FakePlayerState_7( - this, - Invocation.getter(#debugState), - ), - ) as _i2.PlayerState); - - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); - - @override - set onError(_i8.ErrorListener? _onError) => super.noSuchMethod( - Invocation.setter( - #onError, - _onError, - ), - returnValueForMissingStub: null, - ); - - @override - set state(_i2.PlayerState? value) => super.noSuchMethod( - Invocation.setter( - #state, - value, - ), - returnValueForMissingStub: null, - ); - - @override - void dispose({bool? force}) => super.noSuchMethod( - Invocation.method( - #dispose, - [], - {#force: force}, - ), - returnValueForMissingStub: null, - ); - - @override - void resyncPlaybackPositionTimer() => super.noSuchMethod( - Invocation.method( - #resyncPlaybackPositionTimer, - [], - ), - returnValueForMissingStub: null, - ); - - @override - _i2.PlayerState getState() => (super.noSuchMethod( - Invocation.method( - #getState, - [], - ), - returnValue: _FakePlayerState_7( - this, - Invocation.method( - #getState, - [], - ), - ), - returnValueForMissingStub: _FakePlayerState_7( - this, - Invocation.method( - #getState, - [], - ), - ), - ) as _i2.PlayerState); - - @override - void setMediaItem(_i2.MediaItem? mediaItem) => super.noSuchMethod( - Invocation.method( - #setMediaItem, - [mediaItem], - ), - returnValueForMissingStub: null, - ); - - @override - void setError(_i2.PlayerError? error) => super.noSuchMethod( - Invocation.method( - #setError, - [error], - ), - returnValueForMissingStub: null, - ); - - @override - void setPlaybackState(_i2.PlaybackState? playbackState) => super.noSuchMethod( - Invocation.method( - #setPlaybackState, - [playbackState], - ), - returnValueForMissingStub: null, - ); - - @override - void setPlaybackPosition(int? ms) => super.noSuchMethod( - Invocation.method( - #setPlaybackPosition, - [ms], - ), - returnValueForMissingStub: null, - ); - - @override - void setIsInPipMode(bool? isInPipMode) => super.noSuchMethod( - Invocation.method( - #setIsInPipMode, - [isInPipMode], - ), - returnValueForMissingStub: null, - ); - - @override - void setIsBuffering(bool? isBuffering) => super.noSuchMethod( - Invocation.method( - #setIsBuffering, - [isBuffering], - ), - returnValueForMissingStub: null, - ); - - @override - void setStateFromSnapshot(_i7.PlayerStateSnapshot? snapshot) => - super.noSuchMethod( - Invocation.method( - #setStateFromSnapshot, - [snapshot], - ), - returnValueForMissingStub: null, - ); - - @override - bool updateShouldNotify( - _i2.PlayerState? old, - _i2.PlayerState? current, - ) => - (super.noSuchMethod( - Invocation.method( - #updateShouldNotify, - [ - old, - current, - ], - ), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); - - @override - _i8.RemoveListener addListener( - _i8.Listener<_i2.PlayerState>? listener, { - bool? fireImmediately = true, - }) => - (super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - {#fireImmediately: fireImmediately}, - ), - returnValue: () {}, - returnValueForMissingStub: () {}, - ) as _i8.RemoveListener); + }) => (super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + {#fireImmediately: fireImmediately}, + ), + returnValue: () {}, + returnValueForMissingStub: () {}, + ) as _i7.RemoveListener); }