2
votes

Learning flutter, and getting this error when I add @Override on top of the function. Not sure where to import it from. In Android Studio, I used to hit Alt+Enter to import, but I am using Visual Studio Code, not sure what to do in this case.

Undefined name @Override used as annotation. Try defining the name or importing it from another library.

Compiler message: lib/main.dart:17:4: Error: Getter not found: 'Override'. @Override ^^^^^^^^ lib/main.dart:17:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
@Override

  @Override
  Widget build(BuildContext context) {

    ...
  }
1
It should be @override with a lowercase "o".jamesdlin
Yes! Thank you, can't believe i missed that!live-love

1 Answers

1
votes

Check your spelling if you get this error message, it could be a spelling error, like in my case.

If the spelling is correct, try to import it from another library.