currentUser method

Future<BKTResult<BKTUser>> currentUser()

Implementation

Future<BKTResult<BKTUser>> currentUser() async {
  return valueGuard<BKTUser>(
    await _invokeMethod(CallMethods.currentUser.name),
    customMapping: (response) {
      return BKTUserBuilder()
          .id(response['id'])
          .customAttributes(
            Map<String, String>.from(response['data']),
          )
          .build();
    },
  )
      .then((value) => BKTResult.success(data: value))
      .onError((Object error, stackTrace) {
    debugPrint("get currentUser fail: ${error.toString()}");
    return error.toBKTResultFailure();
  });
}