skip to Main Content

I have tried repairing the cache using flutter pub cache repairand also cleaned the project cache using flutter clean.It still doesn’t work.

/C:/Users/Phili/AppData/Local/Pub/Cache/hosted/pub.dev/pinput-2.2.20/lib/src/pinput_state.dart:339:14: Error: The method ‘FocusTrapArea’ isn’t defined for the class ‘_PinputState’.

  • ‘_PinputState’ is from ‘package:pinput/src/pinput.dart’ (‘/C:/Users/Phili/AppData/Local/Pub/Cache/hosted/pub.dev/pinput-2.2.20/lib/src/pinput.dart’).
    Try correcting the name to the name of an existing method, or defining a method named ‘FocusTrapArea’.
    child: FocusTrapArea(
    ^^^^^^^^^^^^^
    Failed to compile application.

anyone answer please

3

Answers


  1. sorry this is coming late! I experienced mine when I updated my Flutter version to 3.7 so what I did was to update the Piput package version to the latest version and that solved mine for me. I hope it helps. I could not fully figure out what happen why it broke my app the first time but it was intuitive for me to upgrade the pinput package.

    Login or Signup to reply.
  2. I had the same issue when I cloned a flutter open source project from Github.
    I resolved it by upgrading the pinput package to its latest version.

    At the time of writing this answer, the latest pinput version is 2.2.31.

    Follow these steps:

    1. In your pubspec.yaml file, change the pinput to the latest version.
    2. In the terminal, run flutter clean
    3. Then run flutter run, it will internally call flutter pub get for you.

    enter image description here

    Login or Signup to reply.
  3. what worked for me is to delete my pubspec.lock then running flutter clean command. hope it’ll work for you

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search