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 :: carousel in flutter curved images onpressed 
Dart :: provider flutter docs 
Dart :: flutter CustomPaint clip 
Dart :: how can i deep copy in dart 
Dart :: global navigator key flutter 
Dart :: flutter logo duration 
Dart :: dart fold 
Dart :: dart call nullable function 
Dart :: anonymous function in dart 
Dart :: flutter concat string list 
Dart :: how to use wrap widget in flutter 
Dart :: dart anonymous function in forEach 
Dart :: restrick platform orientation flutter 
Dart :: flutter navigator get result 
Dart :: flutter sliver persistent header example 
Dart :: how to groupby list of maps in flutter 
Dart :: flutter test from sdk incomapatible with package or plugin 
Dart :: flutter thai language keyboard 
Dart :: Flutter default device font PlatformChannel 
Dart :: factory in dart 
Swift :: center a text in swiftui 
Swift :: swift has Top Notch 
Swift :: how to flip or toggle boolean value in swift 
Swift :: xcode label rotate text 
Swift :: disable dark mode swift 
Swift :: swiftui scrollview hide scrollbar 
Swift :: replace character in swift 
Swift :: how to insert element at start of the array ios swift 
Swift :: convert int to string in swift 
Swift :: swift get "system" asset image 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =