I encountered a problem while importing an Excel file into my mobile application.
At runtime
var excel = Excel.decodeBytes(bytes);
the program stops on the exception:
StateError (Bad state: No element)
At the same time, if I skip all the stops in this place, the console will remain clean (without errors), and the file will be imported correctly.
here is a code
here is a stacktrace
I’m sure that a few days ago I worked with the same Excel file and there were no errors.
I am using the latest version of Excel package
excel: ^4.0.3
I am debugging on the iOS simulator.
I also tried clearing the simulator cache.
I tried loading other Excel files, including empty ones.
I tried making the process asynchronous: file.(readAsBytes)
Tried endurance func to the top level
Excel parseExcelFile(List<int> _bytes) { return Excel.decodeBytes(_bytes); }
and use
Excel excel = await compute(parseExcelFile, _bytes);
But result is same:
StateError (Bad state: No element)
and after skipping all the exceptions in this place, everything is imported correctly.
Hope you can help me!
Thank you!
NickNefyodov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.