call<T> method

T call<T>({
  1. T android()?,
  2. T ios()?,
  3. T web()?,
  4. T macos()?,
  5. T desktop()?,
  6. T mobile()?,
})

Calls the platform-specific action.

Implementation

T call<T>({
  T Function()? android,
  T Function()? ios,
  T Function()? web,
  T Function()? macos,
  T Function()? desktop,
  T Function()? mobile,
}) {
  final value = maybe(
    android: android,
    ios: ios,
    web: web,
    macos: macos,
    desktop: desktop,
    mobile: mobile,
  );

  if (value == null) {
    throw UnsupportedError('Unsupported platform');
  }

  return value;
}