getUserWithId method

Future<AppticsUser?> getUserWithId(
  1. String userId
)

Implementation

Future<AppticsUser?> getUserWithId(String userId) async {
  final userInfoFileContent = await AppticsDataStore.getFileContents(FileType.userInfo);
  if (userInfoFileContent != null) {
    Map<String, dynamic> users = jsonDecode(userInfoFileContent);
    if (users.containsKey(userId)) {
      final userProp = users[userId] as Map<String, dynamic>;
      if (userProp.containsKey("ap_user_id")) {
        return AppticsUser(
          userId,
          userProp["ap_user_id"]
        );
      }
    }
  }

  return null;
}