Create unified interfaces across dart:io and dart:html
Dart runs on the client, thanks to dart:html, and on the command line, thanks to dart:io. However, like oil and water, those two libraries just don't mix. Your web apps can't use dart:io, and your server apps can't use dart:html. Normally, this isn't a problem, because the two different targets are oh so very different. However, some concepts are common, such as Web sockets or HTTP requests. Wouldn't it be nice to have a unified interface to Web sockets that works with either dart:io or dart:html? I'll spare you the suspense: Yes! This post shows you one strategy to design a high-level interface for functionality that exists in both dart:io and dart:html. While the Dart team has the concept of configurability on their radar, not much concrete action has happened. In the meantime, try this strategy and you too can experiment with unifying interfaces and APIs. Code reuse FTW! (This post was inspired by Mark Bennett's original question who is trying to