toMap method

Map toMap()

Conversion to Map

Implementation

Map toMap() {
  Map map = Map();
  if (id != null) map[_ID] = id;
  if (appKey != null) map[_APP_KEY] = appKey;
  if (title != null) map[_TITLE] = title;
  if (body != null) map[_BODY] = body;
  if (icon != null) map[_ICON] = icon;
  if (image != null) map[_IMAGE] = image;
  if (gif != null) map[_GIF] = gif.toString();
  if (action != null) map[_ACTION] = action?.toMap();
  if (buttons.isNotEmpty) {
    PushButton? buttonMap;
    for (var i = 0; i < buttons.length; i++) {
      buttonMap = buttons[i];
    }
    map[_BUTTONS] = buttonMap?.toMap();
  }
  if (layout != null) map[_LAYOUT] = layout.toString();
  if (data != null) map[_DATA] = data;
  map[_SILENT] = silent;
  if (securedData != null) map[_SECUREDDATA] = securedData;
  map[_ISDISPOSABLE] = isDisposable;
  if (sendingId != null) map[_SENDING_ID] = sendingId;
  if (pushId != null) map[_PUSH_ID] = pushId;
  map[_SEND_EVENT_ACK] = sendEventAck;
  if (applicationId != null) map[_APPLICATION_ID] = applicationId;
  return map;
}