Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 8 additions & 21 deletions packages/edge_runtime/lib/src/utils.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
import 'dart:typed_data' show ByteBuffer, Uint8List;

Object? convertBody(Object? body) {
if (body == null) {
return null;
}

if (body is String) {
return body;
}

if (body is Uint8List) {
return body;
}

if (body is ByteBuffer) {
return body;
}

throw ArgumentError.value(
body,
'body',
'Body must be an nullable instance of [String], [ByteBuffer] or [Uint8List].',
);
return switch (body) {
String || Uint8List || ByteBuffer || null => body,
_ => throw ArgumentError.value(
body,
'body',
'Body must be a nullable instance of [String], [ByteBuffer] or [Uint8List].',
),
};
}
2 changes: 1 addition & 1 deletion packages/edge_runtime/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository: https://github.com/invertase/dart_edge/tree/main/packages/edge_runti
version: 0.0.4+1

environment:
sdk: ">=2.18.5 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
freezed_annotation: ^2.2.0
Expand Down