addPersistentRoadblockByCoordinates static method
- required List<
Coordinates> coords, - required DateTime startTime,
- required DateTime expireTime,
- required RouteTransportMode transportMode,
- required String id,
Add an user persistent roadblock to collection ( path impact zone type )
If coords size == 1, a point located roadblock is defined - this may result in 2 real roadblocks for matched road both ways. If coords size > 1, a path located roadblock is defined - this will result in 1 map roadblock in start -> end way
Parameters
- IN coords The roadblock coordinates list
- 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
- The TrafficEvent object and GemError.success if successful
- Null together with the error code if failed:
- GemError.activation means roadblocks are disabled from preferences
- GemError.exist means the roadblock already exist
- GemError.invalidInput means the given parameters are invalid
- GemError.notFound means a suitable street has not been found or that map data is not loaded for the given coordinates
- GemError.inUse means the roadblock id is already in use
- GemError.noRoute means the roadblock cannot be defined using the input coordinates
Throws
- An exception if it fails
Implementation
static Pair<TrafficEvent?, GemError> addPersistentRoadblockByCoordinates({
required List<Coordinates> coords,
required DateTime startTime,
required DateTime expireTime,
required RouteTransportMode transportMode,
required String id,
}) {
final OperationResult resultString = staticMethod(
'TrafficService',
'addPersistentRoadblockCoords',
args: <String, dynamic>{
'coord': coords,
'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,
);
}