What does super and Key do in flutter?

super is used to call the constructor of the base class. So in your example, the constructor of CardTitle is calling the constructor of StatelessWidget.

Keys are used as an identifier for Widgets, Elements, and SemanticsNodes.You don't need to use Keys most of the time, the framework handles it for you and uses them internally to differentiate between widgets. For more on them see: https://flutter.dev/docs/development/ui/widgets-intro#keys 

Post a Comment

Previous Post Next Post

Subscribe Us


Get tutorials, Flutter news and other exclusive content delivered to your inbox. Join 1000+ growth-oriented Flutter developers subscribed to the newsletter

100% value, 0% spam. Unsubscribe anytime