Skip to content

Commit f609b14

Browse files
committed
Imitate the way http is written, let the createGitHubClient method work on dart vm, flutter and web.
1 parent c1208ca commit f609b14

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/github.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// The code come from https://github.com/dart-lang/http/blob/9a17157e6a71972f929a95c6b2b36992e5e02c6d/lib/src/client.dart#L11-L16
2+
3+
// ignore: uri_does_not_exist
4+
// ignore:
5+
export 'github_stub.dart'
6+
// ignore: uri_does_not_exist
7+
if (dart.library.html) 'browser.dart'
8+
// ignore: uri_does_not_exist
9+
if (dart.library.io) 'server.dart';
10+
11+
export 'src/common.dart';

lib/github_stub.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'src/common.dart';
2+
3+
GitHub createGitHubClient(
4+
{Authentication auth, String endpoint = "https://api.github.com"}) =>
5+
throw UnsupportedError(
6+
'Cannot create a client without dart:html or dart:io.');

0 commit comments

Comments
 (0)