flutter_music_picker 0.0.9
flutter_music_picker: ^0.0.9 copied to clipboard
A Flutter plugin for picking music files and ringtones from the device filesystem across Android, iOS, macOS, Windows, Linux, and Web.
0.0.9 #
- Changed: lowered the minimum supported SDK to Dart
3.2.0(Flutter3.16.0) - previously required Dart3.8.1(Flutter3.32.7), significantly broadening compatibility with older Flutter projects - Changed: downgraded
flutter_lintsto^4.0.0(from^6.0.0) so the dev dependency also resolves on Dart 3.2 - Changed: reduced Gradle JVM memory settings in the plugin and example Android builds (
-Xmx4G,MaxMetaspaceSize=1G) to lower build machine requirements
0.0.8 #
- Changed: separated iOS and macOS into independent plugin implementations — no more
sharedDarwinSource; each platform owns its source, podspec, and dependencies independently, matching the Android pattern - Fixed: macOS ringtone scanning now includes
ToneLibrary.frameworkringtones directory — restores full 80+ system ringtone discovery; removed hardcoded fallback list from iOS - Fixed: removed
AVAsset.durationandattributesOfItem(atPath:)calls across iOS/macOS ringtone scanning —durationMsandsizeBytesare now0for all ringtones and macOS music files, eliminating per-file blocking I/O that caused UI freezes
0.0.7 #
- Changed: removed
sharedDarwinSource— iOS and macOS now maintain independent implementations matching the Android pattern, eliminating all SPM/CocoaPods compatibility issues
0.0.6 #
- Fixed: removed
sharedDarwinSource: truefrom iOS/macOS — each platform now has its own independent implementation (same pattern as Android). iOS usesMPMediaQueryfor music library; macOS usesFileManagerdirectory scan. - Fixed: removed all
s.static_framework = truefrom podspecs and removeddarwin/shared source directory. - Fixed:
ios/Classes/FlutterMusicPickerPlugin.swift— iOS-only implementation with MPMediaQuery + AVAudioPlayer - Added:
macos/Classes/FlutterMusicPickerPlugin.swift— macOS-only implementation with FileManager scan + AVAudioPlayer
0.0.5 #
- Fixed: full CocoaPods compatibility restoration — removed
darwinplatform entry frompubspec.yaml, deleteddarwin/flutter_music_picker/Package.swift, and addeddarwin/flutter_music_picker.podspecforsharedDarwinSourceintegration
0.0.4 #
- Fixed: removed
darwinplatform entry frompubspec.yamlto restore CocoaPods compatibility on iOS/macOS (plugin was incorrectly marked as Swift Package Manager only)
0.0.3 #
- Fixed: loading freeze / UI hang on all platforms — removed all synchronous per-file blocking I/O during music discovery:
- macOS: removed
AVAsset(url:).duration(opened every audio file) andattributesOfItem(atPath:)per ringtone - Windows: removed
SHCreateItemFromParsingName+IShellItem2::GetUInt64(PKEY_Media_Duration)COM calls per file; removedpropsys.lib/shlwapi.libdependencies - iOS: removed
AVAsset(url:).durationandattributesOfItem(atPath:)per ringtone; removed Tier 2fileExists(atPath:)× 45 fallback - Android and Linux already clean (pure DB cursor / directory enumeration)
durationMsis now consistently0across all platforms (audio player provides actual duration at playback time)
- macOS: removed
- Fixed: Swift Package Manager support — added
darwin/flutter_music_picker/Package.swift; restructured shared Darwin source underdarwin/Classes/; updatedios/andmacos/podspecs to reference../darwin/Classes/**/*; addeddarwinplugin config in pubspec.yaml - Fixed: pubspec homepage/repository URLs changed from
rndtoArdWang
0.0.2 #
- Fixed: web crash "Cannot set the method call handler before the binary messenger has been initialized" —
FlutterMusicPickerWeb.registerWith()now passesRegistrar(which implementsBinaryMessenger) directly toMethodChannelconstructor - Fixed:
_Ansi.resetappearing as literal text in log output — changed$_Ansi.resetto${_Ansi.reset} - Fixed: web permission crash —
permission_handlerthrowsUnimplementedErroron web forPermission.audio; addedon UnimplementedErrorcatch in example app - Fixed: Windows
PKEY_Media_Durationundeclared identifier — added#include <propkey.h>with manualDEFINE_PROPERTYKEYfallback - Fixed: pubspec Flutter constraint upper bound removed (
>=3.32.7instead of>=3.32.7 <4.0.0) - Added:
AppLoggerutility class with ANSI color-coded console output for debugging
0.0.1 — Initial release #
- Dart API:
FlutterMusicPickerclass withgetMusicFiles(),getRingtones(),getAllAudioFiles(),playRingtone(),stopRingtone()static methods MusicItemdata model with properties:id,title,artist,album,durationMs,uri,sizeBytes,isRingtone, plus convenience gettersformattedDurationandformattedSize- Type-safe parsing:
MusicItem.fromMap()handles values arriving as String, int, num, or bool — resilient to platform channel type variations MusicPickerException: typed exception withmessageand optionalcodefor error handling
Android #
- Music: queries
MediaStore.Audio.Media.EXTERNAL_CONTENT_URIandINTERNAL_CONTENT_URIwithIS_MUSIC = 1filter - Alerts: uses
RingtoneManager(the official Android API) to discover system ringtones (TYPE_RINGTONE), notification sounds (TYPE_NOTIFICATION), and alarm tones (TYPE_ALARM) - Ringtone URIs constructed correctly via
RingtoneManager.getRingtoneUri(position)for cross-device compatibility - Native ringtone playback via
RingtoneManager.getRingtone(context, uri).play() ApplicationContext-compatible — no Activity reference needed- Comprehensive
android.util.Logdebug logging for troubleshooting
iOS #
- Music: queries
MPMediaQuery.songs()from the device music library with authorization check - Alerts: scans
/Library/Ringtonesfor.m4rfiles with a 45-name known-ringtone fallback list - Ringtone preview via
AVAudioPlayerwithAudioServicesPlaySystemSoundfallback os_logdebug logging throughout
macOS #
- Music: scans
~/Musicand~/Downloadsdirectories recursively for audio files - Alerts: scans
/System/Library/Sounds,/Library/Sounds,~/Library/Sounds, and/Library/Ringtones - Duration extraction via
AVAsset - Ringtone preview via
AVAudioPlayer os_logdebug logging throughout
Windows #
- Music: scans user Music folder (
CSIDL_MYMUSIC) and Public Music (CSIDL_COMMON_MUSIC) - Alerts: scans
C:\Windows\Mediafor system sound files - Duration extraction via Windows Shell Property System (
IShellItem2+PKEY_Media_Duration), with manual fallback definition for SDK compatibility - Ringtone preview via Win32
PlaySound()API - C API registration wrapper (
FlutterMusicPickerPluginCApiRegisterWithRegistrar) usingextern "C"linkage andFLUTTER_PLUGIN_EXPORTfor DLL export PluginRegistrarManager::GetRegistrar<PluginRegistrarWindows>()bridge from C handle to C++ object/utf-8compiler flag for MSVC on Chinese Windows (code page 936)
Linux #
- Music: scans
~/Musicand~/Downloads - Alerts: scans
/usr/share/soundsplus XDG data directory sound themes - Ringtone preview by forking
paplay→aplay→ffplay(auto-fallback), withSIGTERMcleanup StandardMethodCodec(notStandardCodecSerializer) for Flutter 3.32+ compatibility
Web #
- Plugin registered via
flutter_web_pluginswith explicitBinaryMessengerfromRegistrar - Returns sample data so the demo UI has content (browsers restrict filesystem access)
- Ringtone playback is a no-op on web
Example app #
- Tabbed UI: Music tab + Alerts tab with item counts
just_audiointegration for music playback with progress slider and play/pause/stop controls- Native ringtone preview with auto-stop timer
- Runtime permission handling via
permission_handlerfor Android (Permission.audiowithPermission.storagefallback) - Material Design 3 with light/dark mode support
- Now-playing bar and ringtone preview bar at the bottom of the screen
- Refresh button to reload music data
Bug fixes included in this release #
- Fixed Android ringtones returning empty: switched from raw MediaStore queries to
RingtoneManager(the API used by system Settings) - Fixed type mismatch crash: ringtone maps returned
Stringvalues fordurationMs/sizeBytes/isRingtone— now alwaysInt/Boolean - Fixed Android music queries: added
INTERNAL_CONTENT_URIfallback for devices where music is on internal storage only - Fixed Dart initialization: replaced unused top-level variable (optimized away by compiler) with
_ensureInitialized()called before every method - Fixed Windows build:
StandardCodecSerializer→StandardMethodCodecfor Flutter 3.32+ compatibility - Fixed Windows build: removed
FLUTTER_PLUGIN_LISToverride from plugin CMakeLists (was corrupting CMake cache) - Fixed Windows build: C4819 Unicode error by replacing em dashes/arrows with ASCII in C++ comments and adding
/utf-8MSVC flag - Fixed Windows build: added
extern "C"C API wrapper acceptingFlutterDesktopPluginRegistrarRef - Fixed Linux build: same
StandardCodecSerializer→StandardMethodCodec+FLUTTER_PLUGIN_LISTcleanup - Fixed
MusicItem.fromMaptype safety: added_parseInt()/_parseBool()helpers handling String/int/num/bool inputs