diff --git a/CHANGELOG.md b/CHANGELOG.md index 19e35d8..3b7f91b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,3 +2,5 @@ create initial release. ## 1.1.0 Changed the import file to be only camel.dart +## 1.2.0 +made it possible to omit the command argument of the Message class. diff --git a/lib/message.dart b/lib/message.dart index 9cae0fd..5a273f1 100644 --- a/lib/message.dart +++ b/lib/message.dart @@ -167,10 +167,10 @@ class Message { /// constructor from params(send data). Message.fromBody({ - required String command, + String? command, required this.body, }) { - header = MessageHeader.fromParam(command: command, bodySize: body.length); + header = MessageHeader.fromParam(command: command ?? "", bodySize: body.length); } } diff --git a/pubspec.yaml b/pubspec.yaml index 92c979e..19bdc7b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: camel description: A Flutter package for communicating in a local network. -version: 1.1.0 +version: 1.2.0 homepage: environment: diff --git a/test/message_test.dart b/test/message_test.dart index 2995740..902ed00 100644 --- a/test/message_test.dart +++ b/test/message_test.dart @@ -239,7 +239,7 @@ void messageFormatTest() { } Message constructMessageFromBody( - {required String command, required String body}) { + {String? command, required String body}) { return Message.fromBody( command: command, body: body); //Uint8List.fromList(utf8.encode(body))); } @@ -253,7 +253,7 @@ void checkMessageCommandAndBody( void messageConstructFromSendTest() { group("constructor from sender", () { test("should be construct message command and body", () { - Message message = constructMessageFromBody(command: "", body: ""); + Message message = constructMessageFromBody(body: ""); checkMessageCommandAndBody(message: message, command: "", body: ""); });