subscribeUserStatus static method

Stream<UserStatus> subscribeUserStatus()

Subscribes to the UserStatus

Throws a PlatformException when getting the userStatus failed Throws a MissingPluginException if the method is not implemented on the native platforms.

Implementation

static Stream<UserStatus> subscribeUserStatus() {
  try {
    var userStatusSubscription = _userStatusChannel.receiveBroadcastStream();
    return userStatusSubscription.asyncMap((userStatusJson) {
      var userStatusMap =
          jsonDecode(userStatusJson.toString()) as Map<String, dynamic>;
      return UserStatus.fromJson(userStatusMap);
    });
  } on Exception catch (e) {
    _logException(MethodNames.subscribePlayerContext, e);
    rethrow;
  }
}