Open MarcelGarus opened 4 years ago
It appears to be the native calls in the socket patch that doesn't support custom List<int>
implementations.
nativeWrite(List<int> buffer, int offset, int bytes)
native "Socket_WriteList";
I supposing Dart_TypedDataAcquireData
can't serialize a custom List<int>
implementation when calling into the C++ code.
@lrhn Might you have an opinion on this? I'm thinking the proper fix is to find all native calls expecting a List and to wrap the callers, so they turn the List into a native List. Either that or having the native call support automatically do this.
coming from 2022 Feb. using Dart SDK version: 2.12.0 (stable) (Thu Feb 25 19:50:53 2021 +0100) on "linux_x64" to ask for any updates on this!
Can you please advise?
I encountered the error
Invalid argument(s): Dart_TypedDataAcquireData expects argument 'object' to be of type 'TypedData'.
with the following stack trace whenadd
ing aUint8List
to asocket
:Turns out, I passed in an
EncryptedMessage
from the pinenacl package, which extendsUint8List
. Apparently,Socket
s only accept pureUint8List
s and not objects that extend one.As sockets are pretty low-level, that may make sense implementation-wise, but it's dangerous because it goes against the object-oriented paradigms of Dart. If this behavior is intended, at least the analyzer should warn me and it should be made clear in the documentation.
I'm using Dart 2.7.0 on Windows.