Reputation: 191
I have a question An error occurs when creating an object as shown below.
ex)
final TextEditingController = TextEditingController();
error message is this:
Only static members can be accessed in initializers.
I am curious about the cause of this error and how to fix it
thank you for let me know ~!
Upvotes: 1
Views: 32
Reputation: 1039
Your error here is that you forgot to name your variable. You defined that it is final
of type TextEditingController
but didn't name the variable. In your case, the fix would be (just a suggestion on the variable name: _controller
)
final TextEditingController _controller = TextEditingController();
Upvotes: 2