justkawal / excel

Excel Library for Flutter and Dart - https://pub.dev/packages/excel
MIT License
403 stars 212 forks source link

delete sheet1 #315

Closed esingulten closed 4 months ago

esingulten commented 5 months ago

Hello dear developer, in the previous version, sheet1 was automatically created, and I used to delete sheet1. Now it's automatically created again, but I can't delete it. I get the following error:

UnmodifiableListMixin.removeWhere (dart:_internal/list.dart:139:5) E/flutter (8393): #1 Excel.delete (package:excel/src/excel.dart:279:22)

SebKister commented 5 months ago

Issue seems to be with _archive.files.removeWhere((file) { return file.name.toLowerCase() == _xmlSheetId[sheet]?.toLowerCase(); }); _archive.files is an UnmodifiableListView

amedeop commented 5 months ago

You cannot even rename it: you get the same error.

var defaultSheet = excel.getDefaultSheet() ?? "Sheet1"; excel.rename(defaultSheet, "NewSheetName"); Error: Unsupported operation: Cannot remove from an unmodifiable list This is a bit strange

lexxxel commented 5 months ago

Duplicate of https://github.com/justkawal/excel/issues/309#issuecomment-1914475812

Have you searched the existing issues, before creating this one?

houdayec commented 5 months ago

309

Check this fix:

https://github.com/justkawal/excel/issues/309#issuecomment-1896225285

eduardofcr commented 4 months ago

same issue here