Let's say I have the following integer matrix in Dart:
final List<List<int>> myMatrix = [
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
];
Then I try to store it in Cloud Firestore like this:
await Firestore.instance.collection("anyCollection").add({
"matrix" : myMatrix,
});
But as soon as I run the code above, the simulator crashes and I get the following error:
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c4f02e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50b97b20 objc_exception_throw + 48
2 Runner 0x000000010e83f8b5 _ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 581
3 Runner 0x000000010e83edf3 _ZN8firebase9firestore4util5ThrowENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 67
4 Runner 0x000000010e890589 _ZN8firebase9firestore4util20ThrowInvalidArgumentIJEEEvPKcDpRKT_ + 57
5 Runner 0x000000010e959f65 -[FSTUserDataConverter parseData:context:] + 1045
6 Runner 0x000000010e<…>
Lost connection to device.
I am running cloud_firestore: ^0.13.0+1
(currently the latest version) in the pubspec.yaml
file. Everything is fine when running the flutter doctor
command as well.
What am I doing wrong? Is it even possible to store matrixes in Firestore? If not, can I store that data using another logic?