Created
April 11, 2019 08:44
-
-
Save gladimdim/a38bd16db0f4aab9ebfff61d3de1dd06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Responder { | |
| final ResponderType type; | |
| Call call; | |
| final String name; | |
| Responder({this.type, this.name}); | |
| void respondToCall(Call incoming) { | |
| if (isBusy()) { | |
| throw ResponderBusyException('Responder $name of type $type is busy.'); | |
| } | |
| call = incoming; | |
| } | |
| bool isBusy() { | |
| return this.call != null; | |
| } | |
| endCurrentCall() { | |
| if (this.isBusy()) { | |
| var temp = call; | |
| call = null; | |
| temp.endCall(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment