archive 3.2.0 introduces a regression on spreadsheet_decoder
Closed this issue · 9 comments
After upgrading from 3.2.0 to 3.2.1, following error is found on spreadsheet_decoder package.
Unhandled exception:
type 'Null' is not a subtype of type 'List<int>' in type cast
#0 ZipEncoder.getFileCrc32 (package:archive/src/zip_encoder.dart:91:34)
#1 ZipEncoder.addFile (package:archive/src/zip_encoder.dart:136:15)
#2 ZipEncoder.encode (package:archive/src/zip_encoder.dart:65:7)
#3 SpreadsheetDecoder.encode (package:spreadsheet_decoder/src/spreadsheet.dart:176:25)
#4 main (file:///Users/stephane.este-gracias/repos/sestegra/dart/spreadsheet_decoder/example/spreadsheet_decoder.dart:34:32)
#5 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#6 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
See related issue
sestegra/spreadsheet_decoder#35
Thanks for letting me know, I will look into it.
The issue appears from 3.1.x to 3.2.0.
I found file.content
from ArchiveFile
class is reset to null
in 3.2.0.
@brendan-duncan I found the root cause.
e9955c3#diff-8cf025b6f411b88d1e7911cb07765976f4f5f284b634342eeab10b342dbf75c9L36
List<int>
isn't supported by ArchiveFile
constructor anymore.
Great, thanks for helping figure that out. I'll make that a bit more robust for other incoming data types.
On my side, I can remove the following cast as well.
https://github.com/sestegra/spreadsheet_decoder/blob/master/lib/src/spreadsheet.dart#L194
The update works on both versions.
It'll be a lot more efficient for you to not have that cast anyways. List was used before because it's an abstract class, which Uint8List implements, not because it expected a concrete List.
I'll still update the constructor to be more robust, and handle things like other buffer/array types.
Dart did make List and the typed_arrays confusing, where List is both an abstract class, and a concrete type.
I pushed a commit to git that re-adds List, and adds content type for all TypedData lists (Float32List, etc), and String data.
I tested spreadsheet_decoder package with your commit and it works well.
I published a new release that works well with archive-3.1.x, archive-3.2.x and your current master branch.