current property

FeedbackPlatform get current

Returns the detected FeedbackPlatform for the current host environment.

Inspects dart:io Platform properties when running on native platforms. If running in Flutter Web or an environment where dart:io throws an UnsupportedError, safely catches the exception and returns FeedbackPlatform.web.

Example

final platform = FeedbackPlatform.current;

Implementation

static FeedbackPlatform get current {
  try {
    if (Platform.isIOS) return FeedbackPlatform.ios;
    if (Platform.isMacOS) return FeedbackPlatform.macos;
    if (Platform.isAndroid) return FeedbackPlatform.android;
  } catch (_) {
    // In web or unsupported platform
    return FeedbackPlatform.web;
  }
  return FeedbackPlatform.universal;
}