This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
num mile = 5.3; | |
num km = 4.5; | |
double feh = 104.1; | |
int cel = 25; | |
dynamic mileToKm = mile.toMileToKm().toStringAsFixed(4); | |
dynamic kmtoMile = km.toMileToKm().toStringAsFixed(4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final value = 'Harsh shah'.toCapitalized(); // 'Harsh shah' | |
final vaLUE = 'harsh shah'.toUpperCase(); // 'HARSH SHAH' | |
final valuE = 'harsh shah'.toTitleCase; // 'Harsh Shah' | |
print(value); | |
print(vaLUE); | |
print(valuE); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
String str = "gbgbgb"; | |
String str1 = "email765@gmail.com"; | |
dynamic validate = str.isValidEmail; | |
dynamic validate1 = str1.isValidEmail; | |
if (validate == false) { | |
print("$str is not Valid Email Address\n"); | |
}else{ | |
print("$str is Valid Email\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 5. Find The Union and Intersection of two Sorted array | |
void main() { | |
unionFun(); | |
interSectionFun(); | |
} | |
void unionFun() { | |
var arr1 = [1, 5, 7, 10, 42, 24, 95, 9, 8, 75, 33, 54, 99]; | |
var arr2 = [-555, -121, -85, -48, -33, -6, -3, 0, 87, 99]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 4. Move All the negative elements to one side of the array | |
void main() { | |
sortmethod(); | |
List list = []; | |
var arr = [ | |
-121, | |
12, | |
-33, | |
14, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3. Find The index of Maximum And Minimum Number | |
import "dart:math"; | |
void main() { | |
indexofmaxmin(); | |
} | |
//using reduce method dart:math for min max | |
void indexofmaxmin() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2. Find Maximum and Minimum Number of Array | |
import "dart:math"; | |
void main() { | |
maxAndmin(); | |
usingSort(); | |
usingReduce(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Declare Array/List Of Int Pick and Print Random Element from same Array | |
import "dart:math"; | |
void main() { | |
randomFromList(); | |
randomMethod(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//it is only for k=2 two not for variable of k elements | |
void main() { | |
int i = 0; | |
int j = 0; | |
var list = [4, 5, 2, 5, 4, 3, 1, 3, 4, 1]; | |
var temp = []; | |
dynamic ans = []; | |
for (i = 0; i < list.length - 1; i++) { | |
for (j = i + 1; j < list.length; j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given a list of N integers A = [a1, a2, ..., aN], you have to find those integers which are | |
// repeated at least K times. | |
// Sample Input : [4, 5, 2, 5, 4, 3, 1, 3, 4] K=2 | |
// Output : 4 5 3 | |
void main() { | |
repeatedAtleastKTimes(2); | |
} | |
void repeatedAtleastKTimes(int k) { |
NewerOlder