convertLogsToUserActionModels method
List<UserActionModel>
convertLogsToUserActionModels(
- List<String> logs
)
Implementation
List<UserActionModel> convertLogsToUserActionModels(List<String> logs) {
List<UserActionModel> userActionModels = [];
for (var log in logs) {
try {
// Parse each log string into a Map using JSON decoding
Map<String, dynamic> logMap = jsonDecode(log);
// Use the generated mappers to create a UserActionModel from the log data
UserActionModel model = UserActionModelMapper.fromMap(logMap);
// Add the model to the list
userActionModels.add(model);
} catch (e) {
if (kDebugMode) {
print('Error parsing log: $log, error: $e');
}
}
}
return userActionModels;
}