ServiceCodec<Req, Res> class final

Converter for a ROS 2 service's request/response pair.

Keyed by the Dart request type, which uniquely identifies the service interface, so callService(AddTwoIntsRequest(a: 1, b: 2)) needs no type strings at the call site.

Annotations
  • @immutable

Constructors

ServiceCodec({required String serviceType, required Map<String, Object?> encodeRequest(Req request), required Res decodeResponse(Map<String, Object?> json), Req decodeRequest(Map<String, Object?> json)?, Map<String, Object?> encodeResponse(Res response)?})
const

Properties

decodeRequest → Req Function(Map<String, Object?> json)?
Needed only to serve a service from Dart.
final
decodeResponse → Res Function(Map<String, Object?> json)
final
encodeRequest → Map<String, Object?> Function(Req request)
final
encodeResponse → Map<String, Object?> Function(Res response)?
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serviceType → String
e.g. example_interfaces/srv/AddTwoInts.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited