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

Fix 'Unsupported operation: removeAt' error when IconLoadingAnimator … #2302

Closed
wants to merge 1 commit into from

Conversation

chihau
Copy link

@chihau chihau commented May 24, 2024

This is a bug from ai_recipe_generation presented at Google I/O 2024

When you press Submit Prompt button the IconLoadingAnimator show an error: Unsupported operation: removeAt

Captura de pantalla 2024-05-24 a la(s) 10 03 09 a  m

This error occurs because it's trying to remove an element from a constant list

currentIcon = notYetSeenIcons.removeAt(rand.nextInt(notYetSeenIcons.length));

child: IconLoadingAnimator( icons: const [ Symbols.icecream, Symbols.local_pizza, Symbols.restaurant_menu, Symbols.egg, Symbols.bakery_dining, Symbols.skillet, Symbols.nutrition, Symbols.grocery, Symbols.set_meal, Icons.egg_alt, Symbols.oven, Icons.dinner_dining, Icons.outdoor_grill, Icons.cookie, Icons.blender, Symbols.stockpot, ], ),

cc: @domesticmouse @ericwindmill

@domesticmouse
Copy link
Contributor

domesticmouse commented May 29, 2024

It looks like this change is introducing mutable state into a StatelessWidget?

Analyzing ai_recipe_generation...

   info - lib/router.dart:178:28 - Use 'const' literals as arguments to constructors of '@immutable' classes. Try adding 'const' before the literal. - prefer_const_literals_to_create_immutables

1 issue found.

@domesticmouse
Copy link
Contributor

Closing, fix is in #2310

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

Successfully merging this pull request may close these issues.

None yet

2 participants