Search
 
SCRIPT & CODE EXAMPLE
 

DART

dart function

when you want to make a function that 
doesn't use the format return or a function that doesn't return a value
the function base will look like this:

void functionName() {

}

if its returning some thing it will look like this:

functionName() {
	
}
Comment

Function in dart

//Function in Dart

import 'dart:html';

main(List<String> args) {
  func1();
  func2();
  func3(45, 6);
  print("Division 1:${func4()}");
  print("Division 2:${func5(22, 7)}");
  print(PrintMsg());
}

//Type- 1 no argument no return

void func1() {
  print("I am just learning Flutter FrameWork");
}

void func2() {
  var num1 = 12;
  var num2 = 45;
  var num3 = 0;
  num3 = num1 + num2;

  print("Sum $num3");
}

//Type-2  with argumnet with no return
void func3(var num1, var num2) {
  var num3 = 0;
  num3 = num1 * num2;
  print("Multiply:$num3");
}

//Type-3  no argument with return type

double func4() {
  var num1 = 22.0;
  var num2 = 7.0;
  var num3;

  num3 = num1 / num2;
  return num3;
}

//Type-4  with argument with return

double func5(var num1, var num2) {
  var num3;
  num3 = num1 / num2;
  return num3;
}

//Anamous Function
PrintMsg() => "I am just learning Flutter FrameWork";
Comment

dart function syntax

sum(x, y) {
	return x + y;
}

// This is where the app starts executing.
void main() {
  print(sum(3,5)); // => 8
}
Comment

PREVIOUS NEXT
Code Example
Dart :: how to change color notification bar in flutter 
Dart :: flutter remove character from string 
Dart :: dart void 
Dart :: adding animation in flutter 
Dart :: flutter set default language 
Dart :: with keyword in dart 
Dart :: remove native splash screen flutter 
Dart :: difference between hot reload and hot restart in flutter 
Dart :: how to use same bloc in multiple widgets in flutter 
Dart :: how to effect container radius to children flutter 
Dart :: flutter remove item from list 
Dart :: flutter show dialog on start 
Dart :: dart data structures 
Dart :: proportion in flutter 
Dart :: how to convert string into integer in flutter 
Dart :: dart int to str 
Dart :: Ascending order with for loop in dart 
Dart :: flutter image size percentage 
Swift :: swift generate random number 
Swift :: swift continue 
Swift :: how to remove background color for uibutton swift 
Swift :: swift compare string to button title 
Swift :: swiftui navigationview ignore top space 
Swift :: UICollectionView current visible cell index 
Swift :: Properties Swift 
Swift :: swiftui console log 
Swift :: link swiftui 
Swift :: How to find index of list item in Swift? 
Swift :: swift arrays 
Swift :: collectionview cellssize swift 4 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =