EventTopicImpl.create constructor
EventTopicImpl.create({})
Must required type or nameType
Implementation
EventTopicImpl.create(
{Type? type,
String? nameType,
String target = _targetDefault,
String? path,
String? fragment,
String scheme = _shema,
@Deprecated('Use scheme') String? shema,
Map<String, String>? arguments}) {
if (type == null && nameType == null) {
throw EventBusException('Topic.create required type or nameType !');
}
var typeName = '${type ?? nameType}'.replaceAll("?", "^");
// the topic host is "target.type": a dot inside a part breaks parsing
// and makes addresses collide (a.b.int is indistinguishable from a.int)
assert(
!target.contains('.') && !typeName.contains('.'),
'Topic host must be "target.type": "target" and type name must not '
'contain a dot (got "$target.$typeName")');
_uri = Uri(
scheme: shema ?? scheme,
host: '$target.$typeName',
path: path,
fragment: fragment,
queryParameters: arguments);
}