Mobile App Development 3 Flashcards
functions
- building blocks of readable, maintainable, and reusable code
- statements to perform a specific task
- organize the program into logical
blocks of code
function definition specifies what and how a specific task would be done
defining a function
a function must be called sa as to execute it
calling a function
functions may return value along with control, back to the caller
returning a function
paremeters are a mechanism to pass values to functions
parameterized function
functions and descriptions
- defining a function
- calling a function
- returning a function
- parameterized function
- can be used when arguments need not be compulsorily passed for a function’s execution.
- A parameter can be marked optional by appending a question mark to its name.
Optional Parameters
three types of optional parameters in Dart
- optional positional paramaters
- optional named parameters
- optional parameters with default values
to specify this paramater, use bracket[]
optional positional parameter
- parameter’s name must be specified while name value is passed
- {} can be used to specify
optional named parameters
- values can also be defined by default
- parameters can be explicitly passed values
optional parameter with default value
- technique for iterating over an operation by having a function call to itself
repeatedly until it arrives at a result - best applied when you need to call the
same function repeatedly with different parameters from within a loop.
recursion
Lambda
- concise mechanism to represent function
- also called as arrow functions
A class definition can include the following
- field
- setter and getter
- constructor
- function
- s any variable declared in a class.
- represent data pertaining to
objects
field
- Allows the program to initialize and retrieve the values of the fields of a class
- associated with every class
setter and getter
responsible for allocating memory for the objects of the class
constructor
- represent actions an object can take
- also known as method
function
components put together are termed
data members
- to create instance, what keyword should be used that is followed by class name
- responsible for instantiation
new
The right-hand side of the expression invokes the constructor (True or False)
True
The constructor should be passed values if it is parameterized (true or flase)
true
what can you access through the object
attribute and functions
if you do not declare a constructor, this is provided for you
no argument constructor
Does dart provides named constructors to enable a class define multiple constructors
Yes or No
Yes
allow the program to initialize and retrieve the values of class fields respectively
Getters and Setters
- A class inherits from another class using the ‘extends’ keyword
- Child classes inherit all properties and methods except constructors from the parent class
Class Inheritance
Types of Inheritance
- single
- multiple
- multi-level
class can at the most extend from one parent class.
Single
A class can inherit from multiple classes. Dart doesn’t support multiple
inheritance
Multiple
class can inherit from another child class
Multi-level
defines the datatype in which output is going to come.
return type
there are four types of functions in Dart
- no parameter and no return type
- parameter and no return type
- no parameter and return type
- parameter and return type