RapideTicketSettings.simple constructor

RapideTicketSettings.simple({
  1. required String projectId,
  2. String? oauthScheme,
  3. String? flavor,
  4. bool includePersonalNetworkInfo = false,
})

Minimal entry point: talks to the hosted API (or localhost in debug), web OAuth = current origin, native OAuth = kRapideTicketDefaultOAuthScheme (overridable).

oauthScheme: non-web only; must match the scheme declared in the native project.

flavor: sent as environment on issues (default kRapideTicketSdkDefaultFlavor).

Implementation

factory RapideTicketSettings.simple({
  required String projectId,
  String? oauthScheme,
  String? flavor,
  bool includePersonalNetworkInfo = false,
}) {
  final pid = normalizeProjectId(projectId);
  final err = projectIdValidationMessage(projectId);
  if (err != null) {
    throw ArgumentError.value(projectId, 'projectId', err);
  }
  final rawFlavor = flavor?.trim();
  final flavorResolved = (rawFlavor != null && rawFlavor.isNotEmpty)
      ? rawFlavor
      : kRapideTicketSdkDefaultFlavor;
  final api = resolveDefaultApiBaseUrl();
  if (kIsWeb) {
    return RapideTicketSettings(
      apiBaseUrl: api,
      projectId: pid,
      oauthLoginReturnUri: webOAuthReturnUriFromCurrentOrigin(),
      allowOauthWithServerDefaultReturnUri: false,
      flavor: flavorResolved,
      includePersonalNetworkInfo: includePersonalNetworkInfo,
    );
  }
  final rawScheme = oauthScheme?.trim();
  final scheme = (rawScheme != null && rawScheme.isNotEmpty)
      ? rawScheme
      : kRapideTicketDefaultOAuthScheme;
  final deep = buildOauthDeepLink(
    scheme: scheme,
    path: kRapideTicketDefaultOAuthPath,
  );
  return RapideTicketSettings(
    apiBaseUrl: api,
    projectId: pid,
    oauthLoginReturnUri: deep,
    allowOauthWithServerDefaultReturnUri: false,
    flavor: flavorResolved,
    includePersonalNetworkInfo: includePersonalNetworkInfo,
  );
}