Skip to content

Commit

Permalink
Support rxdart 0.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed May 29, 2021
1 parent af5b8ea commit e3b4a1b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
2 changes: 0 additions & 2 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Generated file. Do not edit.
//

// clang-format off

import FlutterMacOS
import Foundation

Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ dependencies:
sdk: flutter

path_provider: ^2.0.1
audio_session: ^0.1.0
just_audio: ^0.7.0
audio_session: ^0.1.2
just_audio: ^0.7.5
flutter_tts: ^3.0.0
rxdart: ^0.26.0
rxdart: ^0.27.0
audio_service:
path: ../

Expand Down
21 changes: 14 additions & 7 deletions lib/audio_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ class AudioService {

/// The children of the current browse media parent.
static List<MediaItem>? get browseMediaChildren =>
_browseMediaChildrenSubject.value;
_browseMediaChildrenSubject.nvalue;

static final _playbackStateSubject = BehaviorSubject<PlaybackState>();

Expand All @@ -545,7 +545,7 @@ class AudioService {

/// The current playback state.
static PlaybackState get playbackState =>
_playbackStateSubject.value ?? AudioServiceBackground._noneState;
_playbackStateSubject.nvalue ?? AudioServiceBackground._noneState;

static final _currentMediaItemSubject = BehaviorSubject<MediaItem?>();

Expand All @@ -554,15 +554,15 @@ class AudioService {
_currentMediaItemSubject.stream;

/// The current [MediaItem].
static MediaItem? get currentMediaItem => _currentMediaItemSubject.value;
static MediaItem? get currentMediaItem => _currentMediaItemSubject.nvalue;

static final _queueSubject = BehaviorSubject<List<MediaItem>?>();

/// A stream that broadcasts the queue.
static ValueStream<List<MediaItem>?> get queueStream => _queueSubject.stream;

/// The current queue.
static List<MediaItem>? get queue => _queueSubject.value;
static List<MediaItem>? get queue => _queueSubject.nvalue;

static final _notificationSubject = BehaviorSubject.seeded(false);

Expand All @@ -571,7 +571,8 @@ class AudioService {
_notificationSubject.stream;

/// The status of the notificationClick event.
static bool get notificationClickEvent => _notificationSubject.value ?? false;
static bool get notificationClickEvent =>
_notificationSubject.nvalue ?? false;

static final _customEventSubject = PublishSubject<dynamic>();

Expand Down Expand Up @@ -686,7 +687,7 @@ class AudioService {
}
await _channel.invokeMethod("connect");
final running = (await _channel.invokeMethod<bool>("isRunning"))!;
if (running != _runningSubject.value) {
if (running != _runningSubject.nvalue) {
_runningSubject.add(running);
}
_connected = true;
Expand Down Expand Up @@ -717,7 +718,7 @@ class AudioService {
static ValueStream<bool> get runningStream => _runningSubject.stream;

/// True if the background audio task is running.
static bool get running => _runningSubject.value ?? false;
static bool get running => _runningSubject.nvalue ?? false;

/// Starts a background audio task which will continue running even when the
/// UI is not visible or the screen is turned off. Only one background audio task
Expand Down Expand Up @@ -2010,3 +2011,9 @@ class _AsyncTaskQueueEntry {
typedef _AsyncTask = Future<dynamic> Function();

bool get _testMode => !kIsWeb && Platform.environment['FLUTTER_TEST'] == 'true';

/// Backwards compatible extensions on rxdart's ValueStream
extension _ValueStreamExtension<T> on ValueStream<T> {
/// Backwards compatible version of valueOrNull.
T? get nvalue => hasValue ? value : null;
}
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ environment:
flutter: ">=1.12.13+hotfix.5"

dependencies:
audio_session: ^0.1.0
rxdart: ^0.26.0
audio_session: ^0.1.2
rxdart: '>=0.26.0 <0.28.0'
flutter_isolate: ^2.0.0
flutter_cache_manager: ^3.0.0
js: ^0.6.3
Expand Down

0 comments on commit e3b4a1b

Please sign in to comment.