parsePurchaseState function Null safety

PurchaseState parsePurchaseState(
  1. String state
)

Implementation

PurchaseState parsePurchaseState(String state) {
  switch (state) {
    case 'PURCHASED':
      return PurchaseState.PURCHASED;
    case 'REFUNDED':
      return PurchaseState.REFUNDED;
  }
  throw StateError('state is not defined');
}