stevenroose / dart-eventsource

A client and server implementation of Server-Side Events.
MIT License
56 stars 49 forks source link

Fix typedef error: (Duration) => void is not a subtype of (dynamic) => void #4

Closed NBTX closed 5 years ago

NBTX commented 5 years ago

Sorry about the rubbish commit descriptions, I was just playing around in the hopes I could get it working.

stevenroose commented 5 years ago

Could you perhaps make it into a single commit and not update the pubspec? Also, I don't understand how what you changed makes a difference, isn't it (Duration) => void in both cases?

Thanks for the contribution, btw! Good to see some usage!

NBTX commented 5 years ago

I thought I'd get that. Sure thing.

I thought so but changing the type definition to include a variable name in the parameter seemed to fix the problem.

stevenroose commented 5 years ago

Well if it helps your cause, I'm happy to accept it after you handled the nit ;)

NBTX commented 5 years ago

Removed the other commits 😛 Thanks

NBTX commented 5 years ago

Also is there any way to close the EventSource?

stevenroose commented 5 years ago

I'm not sure anymore how it works in the case of a [broadcast stream(https://github.com/stevenroose/dart-eventsource/blob/master/lib/eventsource.dart#L47), but I think when you call listen() and then cancel() the subscription object, the stream will be closed and that will ripple up to the HTTP stream that we are transforming.

But in all honesty, it's been years since I looked decently at any Dart code.

stevenroose commented 5 years ago

Thanks for the fix, btw.