LocationSharingFor.fromJson constructor

LocationSharingFor.fromJson(
  1. Map<String, dynamic> data
)

Implementation

LocationSharingFor.fromJson(Map<String, dynamic> data) {
  from = (data['from'] != null && data['from'] != 'null')
      ? DateTime.parse(data['from']).toLocal()
      : null;
  to = (data['to'] != null && data['to'] != 'null')
      ? DateTime.parse(data['to']).toLocal()
      : null;
  locationSharingType =
      data['locationSharingType'] == 'LocationSharingType.Event'
          ? LocationSharingType.Event
          : LocationSharingType.P2P;
  isAccepted = data['isAccepted'] == 'true' ? true : false;
  isExited = data['isExited'] == 'true' ? true : false;
  isSharing = data['isSharing'] == 'true' ? true : false;
}