Skip to content

Commit 5374efa

Browse files
committed
fix: use stub file for dart:io usage
1 parent cac01bb commit 5374efa

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

packages/supabase/lib/src/constants.dart

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
import 'package:supabase/src/version.dart';
2-
import 'dart:io' show Platform;
3-
4-
const bool kIsWeb = bool.fromEnvironment('dart.library.js_util');
2+
import 'platform_stub.dart' if (dart.library.io) 'platform_io.dart';
53

64
class Constants {
7-
static String? get platform {
8-
return kIsWeb ? null : Platform.operatingSystem;
9-
}
10-
11-
static String? get platformVersion {
12-
return kIsWeb ? null : Platform.operatingSystemVersion;
13-
}
14-
155
static final Map<String, String> defaultHeaders = {
166
'X-Client-Info': 'supabase-dart/$version',
177
if (platform != null)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import 'dart:io';
2+
3+
String? get platform {
4+
return Platform.operatingSystem;
5+
}
6+
7+
String? get platformVersion {
8+
return Platform.operatingSystemVersion;
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
String? get platform {
2+
return null;
3+
}
4+
5+
String? get platformVersion {
6+
return null;
7+
}

0 commit comments

Comments
 (0)