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.13k stars 179 forks source link

search_controller error #376

Closed dongmin7208 closed 1 year ago

dongmin7208 commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce

<Please add a small sample to that can be executed to reproduce the problem. As a general rule, 100 lines is the maximum>

Expected behavior A clear and concise description of what you expected to happen.

Not running since version 19 in a VSC environment.

Not possible 0.20.0 0.19.0

Possible 0.18.6

I looked it up and found the flutter version 3.7.12, there is no SearchController.

In 3.10.6, there is a SearchController.

I want to use it in Flutter 3.7.12 because of the dependency. It would be nice if you could give me a chance to fix the package.

Below are the error messages

Launching lib/main.dart on Chrome in debug mode...
main.dart:1
: Error: Type 'SearchController' not found.
search_controller.dart:7
SearchController useSearchController({List<Object?>? keys}) {
^^^^^^^^^^^^^^^^
: Error: Type 'SearchController' not found.
search_controller.dart:11
class _SearchControllerHook extends Hook<SearchController> {
                                         ^^^^^^^^^^^^^^^^
: Error: Type 'SearchController' not found.
search_controller.dart:15
  HookState<SearchController, Hook<SearchController>> createState() =>
            ^^^^^^^^^^^^^^^^
: Error: Type 'SearchController' not found.
search_controller.dart:15
  HookState<SearchController, Hook<SearchController>> createState() =>
                                   ^^^^^^^^^^^^^^^^
: Error: Type 'SearchController' not found.
search_controller.dart:20
    extends HookState<SearchController, _SearchControllerHook> {
                      ^^^^^^^^^^^^^^^^
: Error: Type 'SearchController' not found.
search_controller.dart:27
  SearchController build(BuildContext context) => controller;
  ^^^^^^^^^^^^^^^^
: Error: Method not found: 'SearchController'.
search_controller.dart:21
  final controller = SearchController();
                     ^^^^^^^^^^^^^^^^

Failed to compile application. Exited

davidmartos96 commented 1 year ago

Is there any particular reason you need version 0.19.0 and greater? You could keep using 0.18.x while you don't upgrade Flutter to 3.10 which is the current stable release.

dongmin7208 commented 1 year ago

Okay, I'll use 0.18! Thank you!

FarhanSyedain commented 1 year ago

Faced the same error thanks

rrousselGit commented 1 year ago

Either upgrade Flutter or use a lower hooks version