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