rrousselGit / flutter_hooks

React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.
MIT License
3.06k stars 175 forks source link

flutter_hooks: ^0.20.3 #396

Closed macasas closed 7 months ago

macasas commented 7 months ago

I have been using final textEditingController = useTextEditingController(); in a project for a few weeks, no problem until this afternoon.

Now this, and every other project using useTextEditingController is flagging an error.

The method 'useTextEditingController' isn't defined for the type 'TodoItem'.
Try correcting the name to the name of an existing method, or defining a method named 'useTextEditingController'.

As if import 'package:flutter_hooks/flutter_hooks.dart'; has gone missing. When I remove the import, the lovely flutter list of options to import the correct package does not list it. I went back to the riverpod example todos which uses the same code, as soon as I clicked on the word useTextEditingController up came the same error, and this also has worked for a fortnight until now.

It's as if useTextEditingController just disappeared!! Because I have useFocusNode() in the same file and it is clearly linked to package:flutter_hooks/flutter_hooks.dart

I have cleaned, pub get, etc... to the same error I have recreated pods

And when I try to flutter run

Failed to build iOS app
Error (Xcode):
../../../../../.pub-cache/hosted/pub.dev/flutter_hooks-0.20.3/lib/src/text_control
ler.dart:10:3: Error: 'TextEditingController' isn't a type.

Totally confused!

macasas commented 7 months ago

Switching back to 0.18.6 and problem disappeared. Removed .pub-cache 0.20.3 and reinstalled, I guess I must have corrupted something unknowingly because all is well in the world again :-)

rrousselGit commented 7 months ago

Sounds like a pub issue then :)