start method
Implementation
void start(Config config) {
if (config.key?.isNotEmpty == false &&
config.targetUrl?.isNotEmpty == false &&
config.customReportingFunction == null) {
throw Exception(
'Cannot initialize: No API key, target url or custom reporting function provided.');
}
if (config.projectId?.isNotEmpty == false &&
config.targetUrl?.isNotEmpty == false &&
config.customReportingFunction != null) {
throw Exception(
'Cannot initialize: No project ID, target url or custom reporting function provided.');
}
customReportingFunction = config.customReportingFunction;
apiKey = config.key;
projectId = config.projectId;
referer = config.referer ?? "";
targetUrl = config.targetUrl;
context = config.context ?? ErrorContext();
serviceContext = ServiceContext(
service: config.service ?? 'web', version: config.version ?? "");
reportUncaughtExceptions = config.reportUncaughtExceptions != false;
disabled = config.disabled;
registerHandlers(this);
}