Skip to main content

In-app Fetch User Data

Active update by Flutter Main App

whenever Flutter Main App needs to get the latest data for a user

Future<gofa_user.User?> LessonSdkManager.getCurrentUserData({
DateTime? startDate,
DateTime? endDate,
}) async {
// if startDate is null, set it to 30 days ago
startDate ??= DateTime.now().subtract(const Duration(days: 30));

// if endDate is null, set it to current date
endDate ??= DateTime.now();

// validate startDate and endDate
if (startDate.isAfter(endDate)) {
throw Exception('startDate is after endDate.');
}
...
}

// e.g.
GetIt.I<LessonSdkManager>().getCurrentUserData(
startDate: startDate,
endDate: endDate,
)

For details of the User class data structure, please refer to data-schema