Skip to content

Conversation

@ahsanirfan961
Copy link

I encountered this bug,

════════ Exception caught by widgets library ═══════════════════════════════════
The following UnsupportedError was thrown building MapLocationSelectWidget(dependencies: [InheritedCupertinoTheme, _InheritedTheme, _LocalizationsScope-[GlobalKey#50ace]], state: _MapLocationSelectWidgetState#fc789):
Unsupported operation: Cannot clear an unmodifiable list

The relevant error-causing widget was:
MapLocationSelectWidget MapLocationSelectWidget:file:///D:/Ahsan/Job/Point-of-Sale-Project/frontend/lib/components/widgets/form/address_field.dart:85:9

When the exception was thrown, this was the stack:
#0 UnmodifiableListMixin.clear (dart:_internal/list.dart:157:5)
list.dart:157
#1 _SearchFieldState.didUpdateWidget (package:searchfield/src/searchfield.dart:711:22)

Can't modify immutable list. So I replaced filteredResult.clear() with filteredResult = [].

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing using flutter test

If you need help, consider pinging the maintainer @maheshj01

@maheshj01
Copy link
Owner

Hey @ahsanirfan961, thanks for the PR do you have a minimal reproduction where it fails?

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.

2 participants