-
-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate Dart and Flutter code #642
base: major
Are you sure you want to change the base?
Separate Dart and Flutter code #642
Conversation
This PR does several different things so there's a lot here worth discussing - maybe a good opportunity to try out a voice call on discord. One thing to consider is that I'd eventually like to use pigeon, once it's more stable and feature complete. Pigeon can create a separate Dart file for all of the messages, but it won't put that into a separate package. I'm not sure if this restructuring would work with Pigeon. One other comment is that it will also be easier to review a broad set of changes like this if they are separate pull requests. For example, moving Dart code into separate files while also editing the dart code makes it difficult to see which lines of code have changed. I would also hold off on splitting each class into a separate file because it's not related to the goal of this PR, and I'd like to evaluate each of those ideas independently. I'm not convinced of having 100 files. |
Why a voice call? I'm open to it, but I generally prefer things in writing because:
The example linked in the Pigeon README actually does exactly this:
I figured that may be the case. The split was more of a byproduct of me breaking down the classes to I could understand and navigate between them better, but I can undo that. |
Sorry I should probably explain the situation a bit more, but my medical condition has forced some lifestyle changes upon me. What has happened is that I have a pinched nerve in the neck which is causing nerve pain down my arm. It's something I wouldn't wish on anyone, and I hope other programmers heed the warning to maintain good posture and take regular breaks from sitting at a computer. But as mentioned in the other issue, I am unable to sit at a computer for long stretches, and I was hoping some of you may be open to voice communication for discussion of big issues (this one qualifies). |
Sorry, I didn't understand. Kudos to you for continuing to maintain these wonderful packages with your condition! |
dfcbeca
to
bae3119
Compare
I've force pushed a new version that doesn't split up any files. |
The idea here is to make as much code as possible usable in Dart without Flutter, so a Dart-only audio_service-like library can use standard data types and handlers.
Ideally, with these changes, one should be able to write a single handler that can be used both with the
audio_service
Flutter plugin and a different non-Flutter library.The changes were made in two stages:
A few API changes had to be made for this to happen:
AudioHandler
no longer has a private constructor (as theaudio_service
package needs to extend it), though the documentation encourages use of the base classBaseAudioHandler
was stripped of its Flutter-specific code, and transferred. Theaudio_service
package now containsBaseFlutterAudioHandler
instead. To prevent incorrect usage ofBaseAudioHandler
, it must be imported explicitly or else it won't be accessible.toMessage
functions in the message classes are publicResolves #641.