Skip to content

Instantly share code, notes, and snippets.

@abdorll
Created August 19, 2022 18:50
Show Gist options
  • Save abdorll/9f68d7605ec76e8615751bb9dbc4c4d5 to your computer and use it in GitHub Desktop.
Save abdorll/9f68d7605ec76e8615751bb9dbc4c4d5 to your computer and use it in GitHub Desktop.
hollow-eucalyptus-9972

hollow-eucalyptus-9972

Created with <3 with dartpad.dev.

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')).
// map((e)=> e.name!).toList());
//bikes.every((a)=> a.power!>1)?print('>1'):print('<1');
// final names= carsName.reduce((a,b)=>'$a$b');
// print(names);
// final power=
// carsPower..sort((a,b)=> a.compareTo(b));
// power.forEach((car)=> print(car));
// carsName.contains("ax")?print('yes'):print('no');
//print(carsName[0][0]);
//carsName.forEach((car)=> print(car));
}
final carsName =
bikes.map((bike){
final name = bike.name;
return '$name';
}).toList();
final carsPower =
bikes.map((bike){
final power = bike.power;
return '$power';
}).toList();
List <Bikes> bikes = [
Bikes(name: "asx", power: 9),
Bikes(name: "wb", power: 2),
Bikes(name: "ko", power: 3),
Bikes(name: "sem", power: 5),
];
class Bikes{
String? name;
int? power;
Bikes({required this.name,
required this.power}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment