0

I have this question for a job interview, and i want to know why the stateful and staless widgets, use extends and why not use implements in Flutter/Dart?

  • You can checkout the answer here showing difference between `extends`, `implements` and `with`: https://stackoverflow.com/q/55295782/10488444 – Bach Mar 01 '21 at 08:14

1 Answers1

0

Extends

extends is usually the go-to when you want to make a more specific version of a class.

When you extend a class, you inherit all properties, methods, etc. If you want to override a method, you prefix the method with @override.

Implements

implements is when you want to make a whole new version of a class but you want to inherit the class type.

When you create a new implementation of a class, you are responsible for supplying everything necessary to make that class function.

ReyHaynes
  • 2,932
  • 1
  • 15
  • 22