Method Overriding in Dart Last Updated : 02 Apr, 2025 Comments Improve Suggest changes 12 Likes Like Report Method overriding occurs in Dart when a child class tries to override the parent class's method. When a child class extends a parent class, it gets full access to the methods of the parent class and thus it overrides the methods of the parent class. It is achieved by re-defining the same method present in the parent class.This method is helpful when you have to perform different functions for a different child class, so we can simply re-define the content by overriding it.Important Points: A method can be overridden only in the child class, not in the parent class itself.Both the methods defined in the child and the parent class should be the exact copy, from name to argument list, except the content present inside the method i.e. it can and can't be the same.A method declared final or static inside the parent class can't be overridden by the child class.Constructors of the parent class can't be inherited, so they can't be overridden by the child class. Simple case of method overridingExample : Dart // Dart Program to illustrate the // method overriding concept class SuperGeek { // Creating a method void show() { print("This is class SuperGeek."); } } class SubGeek extends SuperGeek { // Overriding show method void show() { print("This is class SubGeek child of SuperGeek."); } } void main() { // Creating objects //of both the classes SuperGeek geek1 = new SuperGeek(); SubGeek geek2 = new SubGeek(); // Calling same function // from both the classes // object to show method overriding geek1.show(); geek2.show(); } Output : This is class SuperGeek.This is class SubGeek child of SuperGeek.When there is more than one child classExample : Dart // Dart Program to illustrate the // method overriding concept class SuperGeek { // Creating a method void show() { print("This is class SuperGeek."); } } class SubGeek1 extends SuperGeek { // Overriding show method void show() { print("This is class SubGeek1 child of SuperGeek."); } } class SubGeek2 extends SuperGeek { // Overriding show method void show() { print("This is class SubGeek2 child of SuperGeek."); } } void main() { // Creating objects of both the classes SuperGeek geek1 = new SuperGeek(); SubGeek1 geek2 = new SubGeek1(); SubGeek2 geek3 = new SubGeek2(); // Calling same function // from both the classes // object to show method // overriding geek1.show(); geek2.show(); geek3.show(); } Output : This is class SuperGeek.This is class SubGeek1 child of SuperGeek.This is class SubGeek2 child of SuperGeek.ConclusionMethod overriding in Dart enables child classes to modify the behavior of methods inherited from their parent classes. This feature enhances code reusability and flexibility by allowing different implementations in various child classes. However, there are specific rules governing overriding, including restrictions on final and static methods. Understanding method overriding is crucial for developing modular and maintainable object-oriented programs in Dart. Comment S somsagar2019 Follow 12 Improve S somsagar2019 Follow 12 Improve Article Tags : Dart Dart-OOPs Explore Dart Tutorial 7 min read BasicsIntroduction to Dart Programming Language 4 min read Dart SDK Installation 4 min read Dart - Comments 2 min read Dart - Variables 5 min read Operators in Dart 11 min read Dart - Standard Input Output 3 min read Data TypesDart - Data Types 8 min read Basics of Numbers in Dart 6 min read Strings in Dart 6 min read Dart - Sets 6 min read Dart Programming - Map 7 min read Queues in Dart 3 min read Data Enumeration in Dart 3 min read Control FlowSwitch Case in Dart 2 min read Dart - Loops 4 min read Dart - Loop Control Statements (Break and Continue) 4 min read Labels in Dart 2 min read Key FunctionsDart - Anonymous Functions 2 min read Dart - main() Function 2 min read Dart - Common Collection Methods 2 min read How to Exit a Dart Application Unconditionally? 2 min read Dart - Getters and Setters 3 min read Dart - Classes And Objects 4 min read Object-Oriented ProgrammingDart - this keyword 2 min read Dart - Static Keyword 3 min read Dart - Super and This keyword 4 min read Dart - Concept of Inheritance 5 min read Instance and class methods in Dart 3 min read Method Overriding in Dart 3 min read Getter and Setter Methods in Dart 2 min read Abstract Classes in Dart 4 min read Dart - Builder Class 4 min read Concept of Callable Classes in Dart 4 min read Interface in Dart 3 min read Dart - extends Vs with Vs implements 4 min read Dart - Date and Time 3 min read Using await async in Dart 4 min read Dart UtilitiesHow to Combine Lists in Dart? 3 min read Dart - Finding Minimum and Maximum Value in a List 5 min read Dart - Splitting of String 1 min read Dart ProgramsDart - Sort a List 2 min read Dart - String toUpperCase() Function with Examples 1 min read Dart - Convert All Characters of a String in Lowercase 1 min read How to Replace a Substring of a String in Dart? 2 min read How to Check String is Empty or Not in Dart (Null Safety)? 1 min read Exception Handling in Dart 3 min read Assert Statements in Dart 3 min read Fallthrough Condition in Dart 3 min read Concept of Isolates in Dart 2 min read Advance ConceptsDart - Collections 7 min read Dart - Basics of Packages 2 min read Dart - String codeUnits Property 1 min read HTML Document Object Model and Dart Programming 3 min read Like