Skip to content

Instantly share code, notes, and snippets.

@Dev-Owl
Last active April 5, 2021 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dev-Owl/f1d4f911d0a1d4bc5599d095a25fae7d to your computer and use it in GitHub Desktop.
Save Dev-Owl/f1d4f911d0a1d4bc5599d095a25fae7d to your computer and use it in GitHub Desktop.
Platform code, ahead of time
import 'package:http/http.dart' as http;
http.Client getClient() {
throw UnimplementedError('Unsupported');
}
import 'package:http/http.dart' as http;
http.Client getClient() {
return http.Client();
}
import 'package:http/browser_client.dart';
import 'package:http/http.dart' as http;
http.Client getClient() {
final client = http.Client();
(client as BrowserClient).withCredentials = true;
return client;
}
import 'pillowHttp/pillowHttp_stub.dart'
if (dart.library.io) 'pillowHttp/pillowHttp_app.dart'
if (dart.library.html) 'pillowHttp/pillowHttp_web.dart';
//Further code ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment