actionParser function

IntentAction actionParser(
  1. String actionString
)
  • Method which converts the string value to the IntentAction
  • Used for converting the string from native code to dart type

Example:

 String actionString = 'MAIN'
 IntentAction action = actionParser(actionString);
 print(action);

Output:

 intentAction.main

Implementation

IntentAction actionParser(String actionString) {
  IntentAction? action;

  switch (actionString) {
    case 'PICK':
      action = IntentAction.pick;
      break;
    case 'EDIT':
      action = IntentAction.edit;
      break;
    case 'VIEW':
      action = IntentAction.view;
      break;
    default:
      action = IntentAction.main;
  }

  return action;
}