getPlatformName static method
Detects and returns the string name of the current host operating system platform. Useful for populating context extensions or tracking client environment metadata instead of needing to retype this elsewhere.
Implementation
static String getPlatformName() {
if (kIsWeb) return "Web";
if (Platform.isIOS) return "iOS";
if (Platform.isAndroid) return "Android";
if (Platform.isWindows) return "Windows";
if (Platform.isMacOS) return "macOS";
if (Platform.isLinux) return "Linux";
return "Unknown";
}