v4 is a full rewrite using a federated plugin architecture with Pigeon for type-safe platform channels.
The package name is unchanged. Update your dependency:
dependencies:
flutter_radio_player: ^4.0.0- await player.initialize([
- {"url": "https://example.com/stream", "title": "My Station"},
- {"url": "https://example.com/stream2"},
- ], true);
+ await player.initialize([
+ const RadioSource(url: 'https://example.com/stream', title: 'My Station'),
+ const RadioSource(url: 'https://example.com/stream2'),
+ ], playWhenReady: true);RadioSource supports three fields:
| Field | Type | Description |
|---|---|---|
url |
String |
Stream URL (required) |
title |
String? |
Display name for lock screen |
artwork |
String? |
Asset path or URL for album artwork |
Stream getters are now simple properties instead of method calls:
- player.getPlaybackStream().listen((isPlaying) { ... });
+ player.isPlayingStream.listen((isPlaying) { ... });
- player.getNowPlayingStream().listen((title) { ... });
+ player.nowPlayingStream.listen((NowPlayingInfo info) {
+ print(info.title);
+ });
- player.getDeviceVolumeChangedStream().listen((volume) { ... });
+ player.volumeStream.listen((VolumeInfo vol) {
+ print('${vol.volume}, muted: ${vol.isMuted}');
+ });Note:
nowPlayingStreamnow emitsNowPlayingInfoobjects instead of raw strings.volumeStreamemitsVolumeInfoobjects with both volume level and mute state.
- await player.prevSource();
+ await player.previousSource();- double? volume = await player.getVolume(); // nullable
+ double volume = await player.getVolume(); // non-nullable| Feature | Description |
|---|---|
playOrPause() |
Toggle method that works on both Android and iOS |
dispose() |
Properly release native resources when done |
| Artwork URLs | RadioSource.artwork now accepts both asset paths and remote URLs |
| ICY metadata | Automatic extraction on both platforms via nowPlayingStream |
- Minimum deployment target raised from 12.0 to 14.0
- SwiftAudioEx dependency removed (now uses AVFoundation directly)
- Swift Package Manager supported alongside CocoaPods
- kotlinx-serialization dependency removed
- Uses Media3/ExoPlayer for playback
compileSdk35,minSdk21