Though I have tried applying most of the suggested changes I have seen on SO, nothing has worked so far. I'm getting this common exception here - roleRaw!.map((roleJson) => RoleModel.fromJson(roleJson)).toList();
This is the code
class RoleRepository {
final RoleService roleService;
RoleRepository({required this.roleService});
Future<List<RoleModel>> fetchRoles() async {
final roleRaw = await roleService.fetchRoles();
final jSonConvert = roleRaw!.map((roleJson) => RoleModel.fromJson(roleJson)).toList();
return jSonConvert;
}
}
Error message
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Null check operator used on a null value
E/flutter (20753): #0 RoleRepository.fetchRoles (package:etransfa/christdoes/bank/persistence/repository/role_repository.dart:11:35)
E/flutter (20753): <asynchronous suspension>
What can I do?