fix stackoverflow bug
This commit is contained in:
@@ -890,7 +890,7 @@ class StreamChatClient {
|
||||
String get _authType => _anonymous ? 'anonymous' : 'jwt';
|
||||
|
||||
String get _userAgent =>
|
||||
'stream-chat-dart-client-${Platform.name}-${PACKAGE_VERSION.split('+')[0]}';
|
||||
'stream-chat-dart-client-${CurrentPlatform.name}-${PACKAGE_VERSION.split('+')[0]}';
|
||||
|
||||
Map<String, String> get _commonQueryParams => {
|
||||
'user_id': state.user?.id,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'platform_detector_web.dart' if (dart.library.io) 'src/platform_io.dart';
|
||||
import 'platform_detector_stub.dart'
|
||||
if (dart.library.html) 'platform_detector_web.dart'
|
||||
if (dart.library.io) 'platform_detector_io.dart';
|
||||
|
||||
enum PlatformType {
|
||||
Android,
|
||||
@@ -10,7 +12,8 @@ enum PlatformType {
|
||||
Fuchsia,
|
||||
}
|
||||
|
||||
abstract class Platform {
|
||||
class CurrentPlatform {
|
||||
CurrentPlatform._();
|
||||
static bool get isAndroid => currentPlatform == PlatformType.Android;
|
||||
static bool get isIos => currentPlatform == PlatformType.Ios;
|
||||
static bool get isWeb => currentPlatform == PlatformType.Web;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import 'dart:io';
|
||||
import 'platform_detector.dart';
|
||||
|
||||
//Override default method, to provide .io access
|
||||
PlatformType get currentPlatform {
|
||||
if (Platform.isWindows) return PlatformType.Windows;
|
||||
if (Platform.isFuchsia) return PlatformType.Fuchsia;
|
||||
if (Platform.isMacOS) return PlatformType.MacOS;
|
||||
if (Platform.isLinux) return PlatformType.Linux;
|
||||
if (Platform.isIos) return PlatformType.Ios;
|
||||
if (Platform.isIOS) return PlatformType.Ios;
|
||||
return PlatformType.Android;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import 'platform_detector.dart';
|
||||
|
||||
PlatformType get currentPlatform {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
enum PlatformType {
|
||||
Android,
|
||||
Ios,
|
||||
Web,
|
||||
MacOS,
|
||||
Windows,
|
||||
Linux,
|
||||
Fuchsia,
|
||||
}
|
||||
Reference in New Issue
Block a user