Skip to content

Commit 0e33253

Browse files
author
Ivan Dlugos
committed
comment-out an unreferenced query _stream2 to please the linter.
1 parent 27ff94c commit 0e33253

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

objectbox/lib/src/native/query/query.dart

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -785,53 +785,53 @@ class Query<T> {
785785
/// Stream items by sending pointers from native code.
786786
/// Interestingly this is slower even though it transfers only pointers...
787787
/// Probably because of the slowness of `asTypedList()`, see native_pointers.dart benchmark
788-
Stream<T> _stream2() {
789-
initializeDartAPI();
790-
final port = ReceivePort();
791-
final cStream = checkObxPtr(
792-
C.dartc_query_find_ptr(_cQuery, port.sendPort.nativePort),
793-
'query stream');
794-
795-
var closed = false;
796-
final close = () {
797-
if (closed) return;
798-
closed = true;
799-
C.dartc_stream_close(cStream);
800-
port.close();
801-
};
802-
803-
try {
804-
final controller = StreamController<T>(onCancel: close);
805-
port.listen((dynamic message) {
806-
// We expect Uint8List for data and NULL when the query has finished.
807-
if (message is Uint8List) {
808-
try {
809-
final int64s = Int64List.view(message.buffer);
810-
assert(int64s.length == 2);
811-
final data =
812-
Pointer<Uint8>.fromAddress(int64s[0]).asTypedList(int64s[1]);
813-
controller.add(_entity.objectFromFB(_store, data));
814-
return;
815-
} catch (e) {
816-
controller.addError(e);
817-
}
818-
} else if (message is String) {
819-
controller.addError(
820-
ObjectBoxException('Query stream native exception: $message'));
821-
} else if (message != null) {
822-
controller.addError(ObjectBoxException(
823-
'Query stream received an invalid message type '
824-
'(${message.runtimeType}): $message'));
825-
}
826-
controller.close(); // done
827-
close();
828-
});
829-
return controller.stream;
830-
} catch (e) {
831-
close();
832-
rethrow;
833-
}
834-
}
788+
// Stream<T> _stream2() {
789+
// initializeDartAPI();
790+
// final port = ReceivePort();
791+
// final cStream = checkObxPtr(
792+
// C.dartc_query_find_ptr(_cQuery, port.sendPort.nativePort),
793+
// 'query stream');
794+
//
795+
// var closed = false;
796+
// final close = () {
797+
// if (closed) return;
798+
// closed = true;
799+
// C.dartc_stream_close(cStream);
800+
// port.close();
801+
// };
802+
//
803+
// try {
804+
// final controller = StreamController<T>(onCancel: close);
805+
// port.listen((dynamic message) {
806+
// // We expect Uint8List for data and NULL when the query has finished.
807+
// if (message is Uint8List) {
808+
// try {
809+
// final int64s = Int64List.view(message.buffer);
810+
// assert(int64s.length == 2);
811+
// final data =
812+
// Pointer<Uint8>.fromAddress(int64s[0]).asTypedList(int64s[1]);
813+
// controller.add(_entity.objectFromFB(_store, data));
814+
// return;
815+
// } catch (e) {
816+
// controller.addError(e);
817+
// }
818+
// } else if (message is String) {
819+
// controller.addError(
820+
// ObjectBoxException('Query stream native exception: $message'));
821+
// } else if (message != null) {
822+
// controller.addError(ObjectBoxException(
823+
// 'Query stream received an invalid message type '
824+
// '(${message.runtimeType}): $message'));
825+
// }
826+
// controller.close(); // done
827+
// close();
828+
// });
829+
// return controller.stream;
830+
// } catch (e) {
831+
// close();
832+
// rethrow;
833+
// }
834+
// }
835835

836836
/// For internal testing purposes.
837837
String describe() => dartStringFromC(C.query_describe(_ptr));

0 commit comments

Comments
 (0)