Fix README for style (dart-lang/json_rpc_2#53)

Add an example with content from the readme. This improves the score on
pub and lets me run the analyzer over the example.

- Remove the import prefix for the example, it is especially unwieldy
  for the `Parameters` type annotation.
- Add argument types to the callbacks to avoid implicit `dynamic` which
  makes it harder to use inside the method body.
- Change `[]` inside comments to backticks. `[]` is only used for doc
  comments.
- Drop the `getNamed` API that has not been present since the very first
  code review for this package.
- Use lower camel case for a constant.
- Use single quotes consistently. There was a mix before, this is
  especially important for imports which are idiomatically written with
  single quotes.
- Add a note about message buffering before `listen`.
- Use `WebSocketChannel.connect` for platform agnostic imports.
- Use `async/await` in the client example.
5 files changed
tree: 369eb6b2341ba2fb89068bbb7217273f2ba7b977
  1. pkgs/