0

I was trying to use the indexOf method in Dart and this error occurs. I have simply used two strings and thats it.

Screen Shot of the issue

nvoigt
  • 68,786
  • 25
  • 88
  • 134

1 Answers1

2

You cannot access instance fields before you initialized the object, in this case _MyHomePageState.

See also https://stackoverflow.com/a/63542846/9479695

I think in your case you want to use the initState Method for your Stateful Widget. See https://api.flutter.dev/flutter/widgets/EditableTextState/initState.html

smotastic
  • 378
  • 1
  • 11