dvCrashReportId function

String dvCrashReportId(
  1. DateTime at
)

A report id: unique on the device without asking anything that can fail.

The random part is two 16-bit draws rather than one below 1 << 32: on the web shifts are 32-bit, 1 << 32 is 0, and nextInt(0) throws -- from the session a crash reporter starts at install, before the first frame.

Implementation

String dvCrashReportId(DateTime at) =>
    '${at.microsecondsSinceEpoch.toRadixString(16)}-'
    '${(_idCounter++).toRadixString(16)}-'
    '${_ids.nextInt(0x10000).toRadixString(16).padLeft(4, '0')}'
    '${_ids.nextInt(0x10000).toRadixString(16).padLeft(4, '0')}';