addAntiPersistentRoadblockByArea static method

Pair<TrafficEvent?, GemError> addAntiPersistentRoadblockByArea({
  1. required GeographicArea area,
  2. required DateTime startTime,
  3. required DateTime expireTime,
  4. required RouteTransportMode transportMode,
  5. required String id,
})

Add an user persistent anti-area roadblock to collection

Parameters

  • IN area The geographic area not affected by the roadblock, i.e. the anti-area ( world wide - area ) is the roadblock
  • IN startTime The roadblock start time
  • IN expireTime The roadblock expire time
  • IN transportMode The transport mode for which the roadblock applies
  • IN id The user roadblock id. Can be used to get / delete a defined roadblock

Returns

Throws

  • An exception if it fails

Implementation

static Pair<TrafficEvent?, GemError> addAntiPersistentRoadblockByArea(
    {required GeographicArea area,
    required DateTime startTime,
    required DateTime expireTime,
    required RouteTransportMode transportMode,
    required String id}) {
  final OperationResult resultString = staticMethod(
    'TrafficService',
    'addPersistentAntiRoadblockArea',
    args: <String, dynamic>{
      'area': area,
      'startUTC': startTime.millisecondsSinceEpoch,
      'expireUTC': expireTime.millisecondsSinceEpoch,
      'transportMode': transportMode.id,
      'id': id,
    },
  );

  final GemError error =
      GemErrorExtension.fromCode(resultString['result']['second']);
  if (error != GemError.success) {
    return Pair<TrafficEvent?, GemError>(null, error);
  }

  return Pair<TrafficEvent, GemError>(
    TrafficEvent.init(resultString['result']['first']),
    error,
  );
}