Provider.fromUri constructor

Provider.fromUri(
  1. Uri uri
)

Implementation

factory Provider.fromUri(Uri uri) {
  if (uri.scheme == 'http' || uri.scheme == 'https') {
    return HttpProvider(uri);
  }
  if (uri.scheme == 'ws' || uri.scheme == 'wss') {
    return WsProvider(uri);
  }
  throw Exception('Invalid url: $uri');
}