-
Notifications
You must be signed in to change notification settings - Fork 82
Daemon command boilerplate #200
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
Conversation
webdev/lib/src/daemon/daemon.dart
Outdated
class Daemon { | ||
Daemon( | ||
Stream<Map<String, dynamic>> commandStream, | ||
this.sendCommand, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider modeling sendCommand
as a StreamSink
instead of a function that takes commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna keep this as is since it aligns better with flutter_tools
.
} | ||
|
||
Future<void> shutdown(Map<String, dynamic> args) { | ||
Timer.run(daemon.shutdown); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see if this can run right synchronously... my guess is its cruft from the flutter tools impl?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does also seem a bit sketchy that this is the thing shutting down the daemon even though it isn't creating it... but that part is probably OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to run it after we return the value. I'll add a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could chain this off the future then with a cascade? Timer.run is a weird way to handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do in a follow up PR.
WebDev will initially support Flutter oriented IDE plugins through the daemon protocol outlined here:
https://github.com/flutter/flutter/blob/master/packages/flutter_tools/doc/daemon.md
Only a subsection of the protocol will be implemented. This command is a stop gap solution and is not intended to be supported long term. This code is heavily influenced by the logic in
flutter_tools
here:https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/commands/daemon.dart