Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excel.delete("Sheet1") execute error #309

Closed
yeleibo opened this issue Jan 3, 2024 · 14 comments · Fixed by #319
Closed

excel.delete("Sheet1") execute error #309

yeleibo opened this issue Jan 3, 2024 · 14 comments · Fixed by #319

Comments

@yeleibo
Copy link

yeleibo commented Jan 3, 2024

error info :Cannot remove from an unmodifiable list
image

@Javicg10
Copy link

Javicg10 commented Jan 4, 2024

I have the same error.

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Cannot remove from an unmodifiable list #0 UnmodifiableListMixin.removeWhere (dart:_internal/list.dart:139:5) #1 Excel.delete (package:excel/src/excel.dart:279:22) #2 Excel.rename (package:excel/src/excel.dart:213:7) ...

I'm seeking advice on whether there's a workaround I can implement, or if this is an issue that needs resolution within the package itself. This functionality is crucial to my application, and any guidance or assistance you can provide would be greatly appreciated.

Thank you for your efforts in maintaining this package!

@Javicg10
Copy link

Javicg10 commented Jan 4, 2024

The only solution I came with at the moment is to not rename or delete any sheet, which is a pity because I used this to remove the default Sheet1 and now its there.

@MichiHill1991
Copy link

This is really bad, I need to be able to rename the default sheet or delete it.

@17martix
Copy link

17martix commented Jan 8, 2024

I'm having the same issue, can't delete the sheet created by default

@eapCJ
Copy link

eapCJ commented Jan 8, 2024

Hey there! I stumbled upon the same issue. As a workaround you can wrap the function in a try-catch block, it's temporary but might help you too!

@ksh-b
Copy link

ksh-b commented Jan 10, 2024

excel.setDefaultSheet can be used as workaround for avoiding Sheet1

@maboumra
Copy link

maboumra commented Jan 11, 2024

Great workarounds by @ksh-b and @eapCJ . Thank you!

@ericsu0630
Copy link

This is strange, it wasn't an issue before. I've been using version 2.1.0 and haven't upgraded dart or flutter either, but now I'm suddenly getting this error.

@timobaehr
Copy link

Downgrade is not helping me out. I' getting this error as well with version 3.0.0 and even 2.1.0 as well.

@timobaehr
Copy link

The error is coming from used package archive. One fix is to use latest main branch and the newly added deleteFile function.

Link to pull request: #314

@mtcahill57
Copy link

Until this is resolved, I was able to fix this by setting the version of archive in my own project's pubspec to 3.4.9. Hope this helps someone

@maboumra
Copy link

@mtcahill57 it didn't work for me

@mtcahill57
Copy link

@maboumra
Hmm, I am able to use it properly. My project's pubspec looks like this:

  archive: 3.4.9
  excel: any

then I ran flutter clean; flutter pub get

@Kontrano
Copy link

I had the same issue, However, I upgraded to version 4.0.2 from version 2... something I'm not sure about anymore, however, I never had Archive installed, and once I added it manually it fixed the issue. Is there a chance it's a new dependency that's not auto-installed when upgrading?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet