universal_io 0.1.0 copy "universal_io: ^0.1.0" to clipboard
universal_io: ^0.1.0 copied to clipboard

outdated

Supports a subset of 'dart:io' in all platforms, including the browser.

example/universal_io.dart

import 'dart:async';

import 'package:universal_io/io.dart';
import 'package:universal_io/io_driver.dart';

void main() async {
  // Set IO driver
  IODriver.zoneLocal.defaultValue = new MyDriver();

  // Do something
  final socket = await Socket.connect("google.com", 80);
  socket.close();
}

class MyDriver extends IODriver {
  @override
  Future<Socket> connectSocket(host, int port,
      {sourceAddress, Duration timeout}) {
    print("Attempting to connect to '$host:$port'");
    return super.connectSocket(host, port);
  }
}
212
likes
0
pub points
99%
popularity

Publisher

verified publisherdint.dev

Supports a subset of 'dart:io' in all platforms, including the browser.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http, stream_channel, typed_data

More

Packages that depend on universal_io