EventData constructor

EventData({
  1. required String uuid,
  2. required String type,
  3. required Iterable<int> data,
  4. Iterable<int> metadata = const [],
  5. String contentType = ContentTypes.ApplicationJson,
})

Constructs a new EventData instance.

The

Implementation

EventData({
  required String uuid,
  required this.type,
  required Iterable<int> data,
  Iterable<int> metadata = const [],
  this.contentType = ContentTypes.ApplicationJson,
})  : _uuid = uuid,
      data = UnmodifiableListView(data),
      metadata = UnmodifiableListView(metadata) {
  if (uuid.isEmpty) {
    throw GrpcError.invalidArgument(
      "Member 'uuid' can not be empty",
    );
  }

  if (contentType != ContentTypes.ApplicationJson &&
      contentType != ContentTypes.ApplicationOctetStream) {
    throw GrpcError.invalidArgument(
      'Only ${ContentTypes.ApplicationJson} or '
      '${ContentTypes.ApplicationOctetStream} are acceptable values.',
    );
  }
}