diff --git a/lib/src/messages/abort.dart b/lib/src/messages/abort.dart index 5eb0f8f..f1b0604 100644 --- a/lib/src/messages/abort.dart +++ b/lib/src/messages/abort.dart @@ -7,9 +7,9 @@ abstract class IAbortFields { String get reason; - List get args; + List? get args; - Map get kwargs; + Map? get kwargs; } class AbortFields implements IAbortFields { @@ -18,14 +18,14 @@ class AbortFields implements IAbortFields { this._reason, { List? args, Map? kwargs, - }) : _args = args ?? [], - _kwargs = kwargs ?? {}; + }) : _args = args, + _kwargs = kwargs; final Map _details; final String _reason; - final List _args; - final Map _kwargs; + final List? _args; + final Map? _kwargs; @override Map get details => _details; @@ -34,10 +34,10 @@ class AbortFields implements IAbortFields { String get reason => _reason; @override - List get args => _args; + List? get args => _args; @override - Map get kwargs => _kwargs; + Map? get kwargs => _kwargs; } class Abort implements Message { diff --git a/lib/src/messages/call.dart b/lib/src/messages/call.dart index 277fd35..3a2e371 100644 --- a/lib/src/messages/call.dart +++ b/lib/src/messages/call.dart @@ -7,9 +7,9 @@ abstract class ICallFields { String get uri; - List get args; + List? get args; - Map get kwargs; + Map? get kwargs; Map get options; } @@ -21,14 +21,14 @@ class CallFields implements ICallFields { List? args, Map? kwargs, Map? options, - }) : _args = args ?? [], - _kwargs = kwargs ?? {}, + }) : _args = args, + _kwargs = kwargs, _options = options ?? {}; final int _requestID; final String _uri; - final List _args; - final Map _kwargs; + final List? _args; + final Map? _kwargs; final Map _options; @override @@ -38,10 +38,10 @@ class CallFields implements ICallFields { String get uri => _uri; @override - List get args => _args; + List? get args => _args; @override - Map get kwargs => _kwargs; + Map? get kwargs => _kwargs; @override Map get options => _options; @@ -77,9 +77,9 @@ class Call implements Message { String get uri => _callFields.uri; - List get args => _callFields.args; + List? get args => _callFields.args; - Map get kwargs => _callFields.kwargs; + Map? get kwargs => _callFields.kwargs; Map get options => _callFields.options; @@ -92,12 +92,12 @@ class Call implements Message { @override List marshal() { List message = [id, requestID, options, uri]; - if (args.isNotEmpty) { + if (args != null) { message.add(args); } - if (kwargs.isNotEmpty) { - if (args.isEmpty) { + if (kwargs != null) { + if (args == null) { message.add([]); } message.add(kwargs); diff --git a/lib/src/messages/error.dart b/lib/src/messages/error.dart index cc15af3..93fe3a7 100644 --- a/lib/src/messages/error.dart +++ b/lib/src/messages/error.dart @@ -9,9 +9,9 @@ abstract class IErrorFields { String get uri; - List get args; + List? get args; - Map get kwargs; + Map? get kwargs; Map get details; } @@ -24,15 +24,15 @@ class ErrorFields implements IErrorFields { List? args, Map? kwargs, Map? details, - }) : _args = args ?? [], - _kwargs = kwargs ?? {}, + }) : _args = args, + _kwargs = kwargs, _details = details ?? {}; final int _msgType; final int _requestID; final String _uri; - final List _args; - final Map _kwargs; + final List? _args; + final Map? _kwargs; final Map _details; @override @@ -45,10 +45,10 @@ class ErrorFields implements IErrorFields { String get uri => _uri; @override - List get args => _args; + List? get args => _args; @override - Map get kwargs => _kwargs; + Map? get kwargs => _kwargs; @override Map get details => _details; @@ -94,9 +94,9 @@ class Error implements Message { String get uri => _errorFields.uri; - List get args => _errorFields.args; + List? get args => _errorFields.args; - Map get kwargs => _errorFields.kwargs; + Map? get kwargs => _errorFields.kwargs; Map get details => _errorFields.details; @@ -116,12 +116,12 @@ class Error implements Message { @override List marshal() { List message = [id, msgType, requestID, details, uri]; - if (args.isNotEmpty) { + if (args != null) { message.add(args); } - if (kwargs.isNotEmpty) { - if (args.isEmpty) { + if (kwargs != null) { + if (args == null) { message.add([]); } message.add(kwargs); diff --git a/lib/src/messages/event.dart b/lib/src/messages/event.dart index 7b4ecad..4b7d52d 100644 --- a/lib/src/messages/event.dart +++ b/lib/src/messages/event.dart @@ -7,9 +7,9 @@ abstract class IEventFields { int get publicationID; - List get args; + List? get args; - Map get kwargs; + Map? get kwargs; Map get details; } @@ -21,14 +21,14 @@ class EventFields implements IEventFields { List? args, Map? kwargs, Map? details, - }) : _args = args ?? [], - _kwargs = kwargs ?? {}, + }) : _args = args, + _kwargs = kwargs, _details = details ?? {}; final int _subscriptionID; final int _publicationID; - final List _args; - final Map _kwargs; + final List? _args; + final Map? _kwargs; final Map _details; @override @@ -38,10 +38,10 @@ class EventFields implements IEventFields { int get publicationID => _publicationID; @override - List get args => _args; + List? get args => _args; @override - Map get kwargs => _kwargs; + Map? get kwargs => _kwargs; @override Map get details => _details; @@ -83,9 +83,9 @@ class Event implements Message { int get publicationID => _eventFields.publicationID; - List get args => _eventFields.args; + List? get args => _eventFields.args; - Map get kwargs => _eventFields.kwargs; + Map? get kwargs => _eventFields.kwargs; Map get details => _eventFields.details; @@ -104,12 +104,12 @@ class Event implements Message { @override List marshal() { List message = [id, subscriptionID, publicationID, details]; - if (args.isNotEmpty) { + if (args != null) { message.add(args); } - if (kwargs.isNotEmpty) { - if (args.isEmpty) { + if (kwargs != null) { + if (args == null) { message.add([]); } message.add(kwargs); diff --git a/lib/src/messages/invocation.dart b/lib/src/messages/invocation.dart index dec9622..1f785f9 100644 --- a/lib/src/messages/invocation.dart +++ b/lib/src/messages/invocation.dart @@ -7,9 +7,9 @@ abstract class IInvocationFields { int get registrationID; - List get args; + List? get args; - Map get kwargs; + Map? get kwargs; Map get details; } @@ -21,14 +21,14 @@ class InvocationFields implements IInvocationFields { List? args, Map? kwargs, Map? details, - }) : _args = args ?? [], - _kwargs = kwargs ?? {}, + }) : _args = args, + _kwargs = kwargs, _details = details ?? {}; final int _requestID; final int _registrationID; - final List _args; - final Map _kwargs; + final List? _args; + final Map? _kwargs; final Map _details; @override @@ -38,10 +38,10 @@ class InvocationFields implements IInvocationFields { int get registrationID => _registrationID; @override - List get args => _args; + List? get args => _args; @override - Map get kwargs => _kwargs; + Map? get kwargs => _kwargs; @override Map get details => _details; @@ -83,9 +83,9 @@ class Invocation implements Message { int get registrationID => _invocationFields.registrationID; - List get args => _invocationFields.args; + List? get args => _invocationFields.args; - Map get kwargs => _invocationFields.kwargs; + Map? get kwargs => _invocationFields.kwargs; Map get details => _invocationFields.details; @@ -104,12 +104,12 @@ class Invocation implements Message { @override List marshal() { List message = [id, requestID, registrationID, details]; - if (args.isNotEmpty) { + if (args != null) { message.add(args); } - if (kwargs.isNotEmpty) { - if (args.isEmpty) { + if (kwargs != null) { + if (args == null) { message.add([]); } message.add(kwargs); diff --git a/lib/src/messages/publish.dart b/lib/src/messages/publish.dart index 87123fe..8321e73 100644 --- a/lib/src/messages/publish.dart +++ b/lib/src/messages/publish.dart @@ -7,9 +7,9 @@ abstract class IPublishFields { String get uri; - List get args; + List? get args; - Map get kwargs; + Map? get kwargs; Map get options; } @@ -21,14 +21,14 @@ class PublishFields implements IPublishFields { List? args, Map? kwargs, Map? options, - }) : _args = args ?? [], - _kwargs = kwargs ?? {}, + }) : _args = args, + _kwargs = kwargs, _options = options ?? {}; final int _requestID; final String _uri; - final List _args; - final Map _kwargs; + final List? _args; + final Map? _kwargs; final Map _options; @override @@ -38,10 +38,10 @@ class PublishFields implements IPublishFields { String get uri => _uri; @override - List get args => _args; + List? get args => _args; @override - Map get kwargs => _kwargs; + Map? get kwargs => _kwargs; @override Map get options => _options; @@ -83,9 +83,9 @@ class Publish implements Message { String get uri => _publishFields.uri; - List get args => _publishFields.args; + List? get args => _publishFields.args; - Map get kwargs => _publishFields.kwargs; + Map? get kwargs => _publishFields.kwargs; Map get options => _publishFields.options; @@ -98,12 +98,12 @@ class Publish implements Message { @override List marshal() { List message = [id, requestID, options, uri]; - if (args.isNotEmpty) { + if (args != null) { message.add(args); } - if (kwargs.isNotEmpty) { - if (args.isEmpty) { + if (kwargs != null) { + if (args == null) { message.add([]); } message.add(kwargs); diff --git a/lib/src/messages/result.dart b/lib/src/messages/result.dart index d052d71..c9e3458 100644 --- a/lib/src/messages/result.dart +++ b/lib/src/messages/result.dart @@ -5,9 +5,9 @@ import "package:wampproto/src/messages/validation_spec.dart"; abstract class IResultFields { int get requestID; - List get args; + List? get args; - Map get kwargs; + Map? get kwargs; Map get details; } @@ -18,23 +18,23 @@ class ResultFields implements IResultFields { List? args, Map? kwargs, Map? details, - }) : _args = args ?? [], - _kwargs = kwargs ?? {}, + }) : _args = args, + _kwargs = kwargs, _details = details ?? {}; final int _requestID; - final List _args; - final Map _kwargs; + final List? _args; + final Map? _kwargs; final Map _details; @override int get requestID => _requestID; @override - List get args => _args; + List? get args => _args; @override - Map get kwargs => _kwargs; + Map? get kwargs => _kwargs; @override Map get details => _details; @@ -67,9 +67,9 @@ class Result implements Message { int get requestID => _resultFields.requestID; - List get args => _resultFields.args; + List? get args => _resultFields.args; - Map get kwargs => _resultFields.kwargs; + Map? get kwargs => _resultFields.kwargs; Map get details => _resultFields.details; @@ -82,12 +82,12 @@ class Result implements Message { @override List marshal() { List message = [id, requestID, details]; - if (args.isNotEmpty) { + if (args != null) { message.add(args); } - if (kwargs.isNotEmpty) { - if (args.isEmpty) { + if (kwargs != null) { + if (args == null) { message.add([]); } message.add(kwargs); diff --git a/lib/src/messages/yield.dart b/lib/src/messages/yield.dart index 27aaa51..d08711f 100644 --- a/lib/src/messages/yield.dart +++ b/lib/src/messages/yield.dart @@ -5,9 +5,9 @@ import "package:wampproto/src/messages/validation_spec.dart"; abstract class IYieldFields { int get requestID; - List get args; + List? get args; - Map get kwargs; + Map? get kwargs; Map get options; } @@ -18,23 +18,23 @@ class YieldFields implements IYieldFields { List? args, Map? kwargs, Map? options, - }) : _args = args ?? [], - _kwargs = kwargs ?? {}, + }) : _args = args, + _kwargs = kwargs, _options = options ?? {}; final int _requestID; - final List _args; - final Map _kwargs; + final List? _args; + final Map? _kwargs; final Map _options; @override int get requestID => _requestID; @override - List get args => _args; + List? get args => _args; @override - Map get kwargs => _kwargs; + Map? get kwargs => _kwargs; @override Map get options => _options; @@ -67,9 +67,9 @@ class Yield implements Message { int get requestID => _yieldFields.requestID; - List get args => _yieldFields.args; + List? get args => _yieldFields.args; - Map get kwargs => _yieldFields.kwargs; + Map? get kwargs => _yieldFields.kwargs; Map get options => _yieldFields.options; @@ -82,12 +82,12 @@ class Yield implements Message { @override List marshal() { List message = [id, requestID, options]; - if (args.isNotEmpty) { + if (args != null) { message.add(args); } - if (kwargs.isNotEmpty) { - if (args.isEmpty) { + if (kwargs != null) { + if (args == null) { message.add([]); } message.add(kwargs);