MapxusLocationEvent.fromMap constructor

MapxusLocationEvent.fromMap(
  1. Map map
)

Factory constructor to parse from Map received from EventChannel

Implementation

factory MapxusLocationEvent.fromMap(Map<dynamic, dynamic> map) {
  return MapxusLocationEvent(
    type: map['type'] ?? 'location',
    latitude: map['latitude']?.toDouble() ?? 0.0,
    longitude: map['longitude']?.toDouble() ?? 0.0,
    accuracy: map['accuracy']?.toDouble() ?? 0.0,
    venueId: map['venueId'],
    buildingId: map['buildingId'],
    floor: map['floor'],
    timestamp: map['timestamp'] ?? DateTime.now().millisecondsSinceEpoch,
  );
}