Skip to content

Instantly share code, notes, and snippets.

View abdorll's full-sized avatar
🧑‍💻
Coding...

Abdullah Opadeji abdorll

🧑‍💻
Coding...
View GitHub Profile
@abdorll
abdorll / main.dart
Last active October 13, 2023 12:25
sort list of names with title
void main() {
getNameTitlesWithNames(childNames).forEach((e){
print("\n${e.letterTitle!}");
print(e.nameList);
});
}
class EachTitledNameModel{
String? letterTitle;
List<String>? nameList;
void main() {
getNameTitlesWithNames(childNames).forEach((e){
print("\n${e.letterTitle!}");
print(e.nameList);
});
}
class EachTitledNameModel{
String? letterTitle;
List<String>? nameList=[];
class EachTitledNameModel{
String? letterTitle;
List<String>? nameList=[];
EachTitledNameModel ({this.letterTitle, this.nameList});
}
List<EachTitledNameModel> getNameTitlesWithNames(List<String> nameList){
List<EachTitledNameModel> sortedNameWithTitle = [];
nameList.sort();
for(int i = 0; i<nameList.length; i++){
class EachTitledNameModel{
String? letterTitle;
List<String>? nameList=[];
EachTitledNameModel ({this.letterTitle, this.nameList});
}
List<EachTitledNameModel> getNameTitlesWithNames(List<String> nameList){
List<EachTitledNameModel> sortedNameWithTitle = [];
@abdorll
abdorll / main.dart
Last active December 3, 2023 14:06
Map in dart example
void main() {
// Creating a map of key-value pairs (int to String)
Map<int, String> studentData = {
3620301111: 'Ololade',
3620302222: 'Chukwuemeka',
3620303333: 'Umar',
};
// Accessing values using keys
String ololadeName = studentData[3620301111]!; // 'Ololade'
@abdorll
abdorll / main.dart
Last active December 3, 2023 13:52
List in dart example
void main() {
// ==================BASIC USAGE 1.
// Creating a list of integers
List<int> numbers = [1, 2, 3, 4, 5];
// Creating a list of strings
List<String> fruits = ['apple', 'banana', 'cherry'];
// Adding elements to a list
@abdorll
abdorll / main.dart
Last active October 11, 2023 20:16
void main() {
// ==================BASIC USAGE
// A bool variable can have two values: true or false.
bool isDartFun = true;
bool isProgrammingEasy = false;
bool isRaining = false;
bool isSunny = true;
// ==================BOOLEAN PROPERTIES
void main() {
// ==================BASIC USAGE 1.
String singleQ = 'Single quotes';
String doubleQ ="Double quotes";
String doubleQtInSingQt = 'Double quotes in "single" quotes';
String singleQtInDblQt = "Single quotes in 'double' quotes";
String multilineOne='''A
multiline
@abdorll
abdorll / main.dart
Last active December 3, 2023 13:51
double in dart example
// Import the 'dart:math' library to access mathematical functions.
import 'dart:math';
void main() {
// ==================BASIC USAGE
double height = 190.5; // Declare and initialize a double variable with a decimal value.
double weight = 78.2;
double temperature = 25.3;
double? distance; // Nullable double variable.
distance = 42.0;
// Import the 'dart:math' library to access mathematical functions.
import 'dart:math';
void main() {
// ==================BASIC USAGE
double height = 190.5; // Declare and initialize a double variable with a decimal value.
double weight = 78.2;
double temperature = 25.3;
double? distance; // Nullable double variable.
distance = 42.0;