universal_io 0.2.0 universal_io: ^0.2.0 copied to clipboard
Cross-platform version of 'dart:io'. Supports browser, Node.JS, and other targets.
import 'package:universal_io/io.dart';
import 'dart:html' as html;
void main() async {
// Use 'dart:io' HttpClient API
final httpClient = new HttpClient();
final request = await httpClient.getUrl(Uri.parse("http://googl.com"));
final response = await request.close();
// Add HTML element:
// <h1>Google.com HTTP status: 200</h1>
final text = "Google.com HTTP status: ${response.statusCode}";
html.document.body.append(html.HeadingElement.h1()..appendText(text));
}