withRoles method

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

Returns this user serialized with resolved role data.

The returned map contains the standard user JSON 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
  };
}