withRoles method

Future<Map<String, dynamic>> withRoles()

Returns this user serialized with resolved role data.

The returned map contains this user's toJson() output plus a roles key.

Example:

final payload = await user.withRoles();
print(payload['roles']);

Implementation

Future<Map<String, dynamic>> withRoles() async {
  return {...toJson(), 'roles': await roles};
}