During Day 0 I got the Flutter Environment Running
Goal
To select and test packages needed to make a mStream Music App
The Package Ecosystem
You can search for Dart packages at: https://pub.dartlang.org/
Handling packages in Dart is very similar to handling packages with NPM. You just write the package name and version in the pubspec.yaml
file and the Flutter environment will automatically install it. Some packages require you to edit config files in the Android and iOS directories, but so far all the instructions have been easy to follow.
Packages Needed for A Music App
I'll be testing out the following packages. These should cover all the core features for a music syncing and streaming app:
- HTTP Requests: The aptly named HTTP library
- Filepath Constructor: Path Library
- File Downloads: Download Manager
- Music Playback: Audioplayers Library
HTTP, Path, & Downloads
The HTTP and path libraries were easy to setup and test and worked exactly as expected. Nothing interesting to report here.
The Download Manager worked just fine as well, but I'll be interested to see how it holds up when syncing a large batch of files.
Music Playback
Music playback is more complicated. The audioplayers library provided an easy to use api for creating multiple audio players that could stream from a remote server. Having multiple audio player is crucial for gapless playback. While one player is playing, a second player can cache the next song in the playlist.
The audioplayers library does not tie into any of the native audio controls. So It will be necessary to write some native code for iOS and Android to handle things like lock screen widgets. There is another library called audio_service that handles these things, but it's for Android only and breaks the iOS builds
Conclusion
The Dart package manager is very similar to NPM. The Dart Package Manager website even looks like the NPM website. If you are familiar with Node/NPM you will have no problem getting started with Flutter basics.
When developing for Android a few years ago it took me over a day just to get a http library working. With Flutter I was able to test multiple libraries on both Android and iOS in just a few hours.
The Dart ecosystem already appears to have a lot of core libraries in place as well. It took me no time to find well documented packages for basic things like HTTP requests, download management, etc. My only complaint is that the audio libraries are still immature. However this is not surprising considering how complicated media can be and how new Flutter is.
Next Steps
Like I said above, the media handling libraries are still immature. I'm going to develop media streaming for the app after all other features are done. This way I can re-evalute the media libraries at a later date. Right now I risk developing against an immature library that loses support. If this happens I will have to choose a new library later and then re-write all the code against that.
For now development will concentrate on browsing the music catalog and syncing files between devices. This will be the fastest path to get the app in a useable state. From here, mStream users can use whatever mobile audio app they want to play files after being synced.
Top comments (1)
I'm looking forward to create an app that allows multiple users to stream a song simultaneously. Any suggestions on how to do it?