init static method

void init({
  1. String? baseUrl,
  2. String? currentPath,
  3. String? userAgent,
  4. int? width,
  5. int? height,
  6. String? language,
})

Initializes the PlatformData instance with the given values, falling back to the browser's values for any that are omitted.

Call once at startup, before the first read of PlatformData.current. Each call replaces the instance, so values from an earlier call are not kept.

Implementation

static void init({
  String? baseUrl,
  String? currentPath,
  String? userAgent,
  int? width,
  int? height,
  String? language,
}) {
  _instance = PlatformData._(
    baseUrl: baseUrl ?? '',
    currentPath: currentPath ?? '',
    userAgent: userAgent ?? '',
    width: width ?? 0,
    height: height ?? 0,
    language: language,
  );
}