This file contains 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
//=================COPY AND PASTE ONLY THIS BLOCK TO LEETCODE TO RUN========= | |
//=====================SELECT DART AS THE LANGUAGE BEFORE YOU RUN=========== | |
class Solution { | |
int search(List<int> nums, int target) { | |
int value =nums.indexOf(target); | |
print(value); | |
return value; | |
} | |
} |
This file contains 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
//==============================================RUN AT====================== | |
//=======================================https://dartpad.dev/=============== | |
void main() { | |
GroupManager men = GroupManager(); | |
men.name = "Men"; | |
men.createGroup(); | |
men.updateGroup(); | |
men.deleteGroup(); | |
GroupManager women = GroupManager(); |
This file contains 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() { | |
// Create a string and an element. | |
String string = "hello"; | |
String element = "l"; | |
// Create a list to store the element. | |
List<String> list = []; | |
// Append the element to the list 4 times. | |
for (int i = 0; i < 4; i++) { |
This file contains 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
import 'dart:math'; | |
void main(){ | |
int toAdd =0; | |
int add =bikes.fold(toAdd, (a,b)=> a + b.power!); | |
print(bikes.singleWhere((a)=> a.power!>7, orElse).name! ); | |
// print (add); | |
// print(bikes.where((e)=> | |
// e.name!.contains('b')). |
This file contains 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
import 'dart:math'; | |
void main(){ | |
int toAdd =0; | |
int add =bikes.fold(toAdd, (a,b)=> a + b.power!); | |
print(bikes.singleWhere((a)=> a.power!>7, orElse).name! ); | |
// print (add); | |
// print(bikes.where((e)=> | |
// e.name!.contains('b')). |
This file contains 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
//Root of our application | |
void main () { | |
//Parsing subject and score vals as arguments of scoreAndSubjectResult method | |
scoreAndSubjectResult(60, "Physics"); | |
scoreAndSubjectResult(80, "Chemistry"); | |
} | |
//Give output of subject's score based on the val of the score | |
scoreAndSubjectResult(score, subject){ | |
//Instance of SubjectAndScore class |
This file contains 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 () { | |
scoreAndSubjectResult(60, "Physics"); | |
scoreAndSubjectResult(80, "Chemistry"); | |
} | |
scoreAndSubjectResult(score, subject){ | |
SubjectAndScore subjectAndScore = SubjectAndScore(); |
NewerOlder