inviteUser method

Future<void> inviteUser(
  1. int userId
)

Invites the user with the given userId to the plan.

Implementation

Future<void> inviteUser(int userId) async {
  if (!state.hasData) {
    log('Cannot invite user: No plan loaded.');

    return;
  }

  try {
    await _invites.inviteUser(
      _auth.state.requireData[Webservice.lb_planner_api],
      userId,
    );

    await captureEvent('user_invited');

    await build(this);
  } catch (e, st) {
    log('Failed to invite user.', e, st);

    return;
  }
}