fromMap method

bool fromMap(
  1. Map argsMap
)

Returns true when even's atrributes parsed successfully

Implementation

bool fromMap(Map<dynamic, dynamic> argsMap) {
  int argsCounter = 0;
  int stateVal = 0;
  argsMap.forEach((key, value) {
    if ((key == PjsipConnectPlatform.kArgSubscrId) && (value is int)) {
      subscrId = value;
      argsCounter += 1;
    } else if ((key == PjsipConnectPlatform.kSubscrState) && (value is int)) {
      stateVal = value;
      argsCounter += 1;
    } else if ((key == PjsipConnectPlatform.kResponse) && (value is String)) {
      response = value;
      argsCounter += 1;
    }
  });

  switch (stateVal) {
    case PjsipConnectFlutter.kSubscrStateCreated:
      state = SubscriptionState.created;
    case PjsipConnectFlutter.kSubscrStateUpdated:
      state = SubscriptionState.updated;
    case PjsipConnectFlutter.kSubscrStateDestroyed:
      state = SubscriptionState.destroyed;
  }
  return (argsCounter == 3);
}