fromRawValue static method

CancelFlowResult fromRawValue(
  1. String value
)

Parse a raw result string from the native method channel.

The native bridge sends "paused:

Implementation

static CancelFlowResult fromRawValue(String value) {
  if (value.startsWith('paused:')) {
    final iso = value.substring('paused:'.length);
    final resumesAt = DateTime.tryParse(iso);
    return CancelFlowPaused(resumesAt: resumesAt);
  }
  switch (value) {
    case 'retained':
      return const CancelFlowRetained();
    case 'dismissed':
      return const CancelFlowDismissed();
    case 'paused':
      return const CancelFlowPaused();
    case 'cancelled':
    default:
      return const CancelFlowCancelled();
  }
}