dvSessionDeviceLabel function

String dvSessionDeviceLabel()

What a session from this install is recorded as: the platform and the kind of client, such as Android app or Web browser.

Sent as x-dartvel-device so the sessions page can tell devices apart. Deliberately coarse. A host name, a user name or a hardware identifier would tell a list of devices apart better and would follow the person across sign-outs, which is the fingerprinting the specification rules out; the platform is the same on every launch of an install and says nothing about who holds it.

Implementation

String dvSessionDeviceLabel() {
  if (kIsWeb) return 'Web browser';
  return switch (defaultTargetPlatform) {
    TargetPlatform.android => 'Android app',
    TargetPlatform.iOS => 'iOS app',
    TargetPlatform.macOS => 'macOS app',
    TargetPlatform.windows => 'Windows app',
    TargetPlatform.linux => 'Linux app',
    TargetPlatform.fuchsia => 'Fuchsia app',
  };
}