File tree 1 file changed +8
-0
lines changed
packages/supabase_flutter/lib/src
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1
1
import 'dart:io' ;
2
2
3
3
import 'package:cupertino_http/cupertino_http.dart' ;
4
+ import 'package:flutter/widgets.dart' ;
4
5
import 'package:http/http.dart' as http;
5
6
import 'package:supabase_flutter/supabase_flutter.dart' ;
6
7
import 'package:web_socket_channel/adapter_web_socket_channel.dart' ;
@@ -24,9 +25,16 @@ http.Client getPlatformHttpClient() {
24
25
/// It may return `null` because the differentiation for the other platforms
25
26
/// is done in [RealtimeClient] .
26
27
WebSocketChannel Function (String url)? getPlatformWebSocketChannel () {
28
+ if (isInWidgetTest) return null ;
27
29
if (Platform .isIOS || Platform .isMacOS) {
28
30
return (String url) =>
29
31
AdapterWebSocketChannel (CupertinoWebSocket .connect (Uri .parse (url)));
30
32
}
31
33
return null ;
32
34
}
35
+
36
+ bool get isInWidgetTest {
37
+ return WidgetsBinding .instance.runtimeType
38
+ .toString ()
39
+ .contains ('TestWidgetsFlutterBinding' );
40
+ }
You can’t perform that action at this time.
0 commit comments