Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
FuncitonsOverview
</div>

<DartCodeSnippt codeTitle="FuncitonsOverview">
<pre>
/*
returnType functionName(parameter1, parameter2, ...){
function body
}
*/

void printName(){
print("My name Agent Single");
}
// this is our main function.
void main(){
printName();
}
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
FuncitonsTypes
</div>

<DartCodeSnippt codeTitle="FuncitonsTypes">
<pre>
/*
No Parameter And No Return Type
Parameter And No Return Type
No Parameter And Return Type
Parameter And Return Type
*/

void main(){
// No Parameter & No Return Type
printSomething();

// Parameter & No Return Type
sumTowNumber(10, 80);

// No Parameter & Return Type
String name = returnName();
print(name);

// Parameter & Return Type
String getTriangleArea = triangleArea(20, 30);
print(getTriangleArea);
}

void printSomething(){
print("Supriya got Job.");
}

void sumTowNumber(int a, int b){
print(a+b);
}

String returnName(){
return "Tom Crush";
}

String triangleArea(double base, double height){
double area = (base/2) * height;
return "$area sqM";
}
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script setup>
import { useTutorialEntryPoint } from "../../../../stores/tutorialsEntryPointStore.js";
const tutorialEntryPointStore = useTutorialEntryPoint();

import { defineAsyncComponent } from 'vue';
const FuncitonsParameter = defineAsyncComponent(() =>
import('./3d3_Funcitons_Parameter/3d3_0_Funcitons_Parameter.vue')
)
const PositionalParameter = defineAsyncComponent(() =>
import('./3d3_Funcitons_Parameter/3d3_1_Positional_Parameter.vue')
)
const NamedParameter = defineAsyncComponent(() =>
import('./3d3_Funcitons_Parameter/3d3_2_Named_Parameter.vue')
)
</script>

<template>
<FuncitonsParameter v-if="tutorialEntryPointStore.tutorialCode=='3d3'"></FuncitonsParameter>
<PositionalParameter v-else-if="tutorialEntryPointStore.tutorialCode=='3d3_1'"></PositionalParameter>
<NamedParameter v-else-if="tutorialEntryPointStore.tutorialCode=='3d3_2'"></NamedParameter>
</template>

<style scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
Functions Parameter
</div>

<DartCodeSnippt codeTitle="Functions Parameter">
<pre>
/*
// here a and b are parameters
void add(int a, int b) {
}

Functional Parameter Are Two Types:
1) Positional Parameter
a) Without Default Value
b) With Default Value
2) Named Parameter
a) Required Parameter
b) Optional Parameter
*/
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
Positional Parameter
</div>

<DartCodeSnippt codeTitle="Positional Parameter">
<pre>
/*
Positional Parameter In Dart
*/

void main(){
printDetails("Agent", "Single");

bilDue("Vijay", "Malia");
}

void printDetails(String firstName, String lastName){
print("User Full Name: $firstName $lastName");
}

// Providing Default Value On Positional Parameter
void bilDue(String firstName, String lastName, [String msg ="you don't pay your credit card bill."]){
print("$firstName $lastName, $msg");
}
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
Named Parameter
</div>

<DartCodeSnippt codeTitle="Named Parameter">
<pre>
/*
Named Parameter In Dart
*/

void main(){
printInfo(age: 18, name: "Jenny");
printInfo(name: "Bob Coder");

printDetails(age: 18, name: "Jenny", gender: "Female");

printDetailsAgain("Jenny", "Female");
}

//Named Parameter
void printInfo({String? name, int? age}){
print("$name, your age is: $age");
}

// Use Of Required In Named Parameter
void printDetails({required String name, required String gender, required int age}) {
print('''
Check your details:
Name: $name,
Age: $age,
Gender: $gender
''');
}

// Use Of Optional Parameter
void printDetailsAgain(String name, String gender, [int? age]) {
print('''
Check your details:
Name: $name,
Age: $age,
Gender: $gender
''');
}
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
Anonymous Function
</div>

<DartCodeSnippt codeTitle="Anonymous Function">
<pre>
/*
(parameterList){
// statements
}
*/

void main() {
// Anonymous function
var cube = (int number) {
return number * number * number;
};

print("The cube of 2 is ${cube(2)}");
print("The cube of 3 is ${cube(3)}");
}
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
Arrow Function
</div>

<DartCodeSnippt codeTitle="Arrow Function">
<pre>
/*
returnType functionName(parameters...) => expression;
*/

void main(){
double areaOfRectangle = area(10, 12);
print(areaOfRectangle);
}

double area(double length, double width) => length*width;
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
33 changes: 33 additions & 0 deletions src/views/Tutorials/DartTutorial/3_Functions/6d3_Scope.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
Scope In Function
</div>

<DartCodeSnippt codeTitle="Scope">
<pre>
/*
1) Method Scope
2) Global Scope
*/

// Global Scope
String question = "Is she get some one?";
void main(){
print(question);

// Method Scope
String text = "Yes she got her beloved.";
print(text);
}
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
39 changes: 39 additions & 0 deletions src/views/Tutorials/DartTutorial/3_Functions/7d3_Math.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<script setup>
import { defineAsyncComponent } from 'vue';
const DartCodeSnippt = defineAsyncComponent(() =>
import('../../../../components/CS/DartCodeSnippt.vue')
)
</script>

<template>
<div class="FlxM XLT Tbold Tupper">
Dart Math
</div>

<DartCodeSnippt codeTitle="Math">
<pre>
/*
--------:USEFUL MATH FUNCTION IN DART:--------
new Random();
new Random().nextInt(10);
pow(10,2)
max(10,2)
min(10,2)
sqrt(25)
*/
import 'dart:math';

void main(){
Random random = new Random();
print(random.nextInt(10));

print(pow(10,2));
print(max(10,2));
print(min(66,6));
print(sqrt(16));
}
</pre>
</DartCodeSnippt>
</template>

<style scoped></style>
Loading