Lesson3 - Advance Dart Programming.pptx
Lesson3 - Advance Dart Programming.pptx
PROGRAMMING
FLUTTER
• In Dart, by default collections are heterogeneous.
However, by the use of generics, we can make a
collection to hold homogeneous values. The use of
Generics makes the use of a single compulsory data
type to be held inside the collection. Such
GENERICS
collections are called type-safe collections. By the
use of generics, type safety is ensured in the Dart
language.
GENERIC CLASSES
• A generic class can handle multiple data types without being tied to a specific one.
GENERIC METHODS
• Generic methods allow you to define methods that operate on a generic type.
GENERIC LIST
• In Dart, a List is simply an ordered group of objects. A list is simply an implementation of an array.
GENERIC SET
• In Dart, a Set represents a collection of objects in which each object can exist only once.
GENERIC MAP
• In Dart, Map is a dynamic collection of the key, value pairs.
GENERIC QUEUE
• A queue is a collection that is used when the data is to be inserted in a FIFO (First in first out) manner. In Dart, a queue
can be manipulated at both ends, i.e. at the start as well as the end of the queue.
• Mixins are a way of reusing a class’s methods in
multiple class hierarchies.
MIXINS
MIXINS
• Mixins can be understood as abstract classes used for reusing the methods in various classes that have similar
functions/attribute.
• Mixins are a way to abstract and reuse a family of operations and state.
• It is similar to the reuse you get from extending a class, but is not multiple inheritances. There still only exists one
superclass.
• To use a mixin, use the “with” keyword followed by one or more mixin names.
• In Dart, the extends keyword is typically used to
alter the behavior of a class using Inheritance.
EXTENDS
EXTENDS
• The capability of a class to derive properties and characteristics from another class is called Inheritance. It is ability of
a program to create new class from an existing class.
• In simpler words, we can say that we use extends to create a subclass, and super to refer to the superclass. The class
whose properties are inherited by child class is called Parent Class. Parent class is also known as base class or super
class.
• The class that inherits properties from another class is called child class. Child class is also known as derived class, heir
class, or subclass.
• The extends keyword is the typical OOP class inheritance. If class Second extends class First all properties, variables,
methods implemented in class First are also available in Second class. Additionally, you can override methods.
• You use extend if you want to create a more specific version of a class. For instances if Apple extends from Fruit class, it
means all the properties, variables and functions defined in the Fruit class will be available in the Apple class.
In Dart, the implements keyword is used to enforce
that a class provides its own concrete implementation
for every method and property of an interface or
abstract class. IMPLEMENT
This is useful when you want multiple classes to follow
the same "contract" but provide different behaviors.
IMPLEMENT
• Interfaces define a set of methods available on an object. Dart does not have a syntax for declaring interfaces.
• Class declarations are themselves interfaces in Dart.
• An interface is something that enforces the deriving class to implement a set list of public fields and methods.
EXCEPTION HANDLING AND DEBUGGING TECHNIQUES.
An exception is an error that takes place inside the program. When an exception occurs inside a program the normal flow of the program
is disrupted and it terminates abnormally, displaying the error and exception stack as output. So, an exception must be taken care to
prevent the application from termination.
NOTES
• Exception handling ensures your program doesn't crash due to unexpected errors.
• Debugging techniques like print statements, stack traces, and breakpoints help you identify and fix issues.
• Proper handling of exceptions leads to robust and user-friendly applications.
THANK YOU ☺
RYAN FERMO