0

Anyone know why I would get this error when trying to setup a getter for an UnmodifiableListView in provider?

_TypeError (type 'List<String>' is not a subtype of type 'UnmodifiableListView<String>')

Here is my code

List<String> _failures = [
    '>1.5 year',
    '3 months to 1.5 years',
    '2 weeks to 3 months',
    '2 days to 2 weeks',
    'Now',
  ];

UnmodifiableListView<String> get failures => _failures;

1 Answer 1

1

Please see this. Use this.

UnmodifiableListView<String> get failures => UnmodifiableListView(_failures);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.