Skip to content

Instantly share code, notes, and snippets.

View Chinecherem20199's full-sized avatar

Chinecherem Augustina Ugwuanyi Chinecherem20199

View GitHub Profile
//typedef is a keyword
typedef Action = void Function(int);
void main() {
var values = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var newVlues = <int>[];
void Function(int) multiply5 = (value) => newVlues.add(value * 5);
listOperation(values, multiply5);
print(newVlues);
}
void main() {
var values = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var newVlues = <int>[];
var multiply5 = (int value) => newVlues.add(value * 5);
listOperation(values, multiply5);
print(newVlues);
}
void listOperation(List<int> list, void Function(int) action) {
for (var item in list) {
@Chinecherem20199
Chinecherem20199 / main.dart
Created May 12, 2022 13:21
functions_dart
void main() {
var values = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var newVlues = <int>[];
void Function(int) multiply5 = (value) => newVlues.add(value * 5);
listOperation(values, multiply5);
print(newVlues);
}
void listOperation(List<int> list, void Function(int) action) {
for (var item in list) {
@Chinecherem20199
Chinecherem20199 / main.dart
Created May 5, 2022 04:47
const, final, var etc in Dart
void main() {
//Exercise 3
//Question 1
//Use the declared variables below to decide whether or not a person is eligible to rent movies
//A person is eligible when the age is more than 20 and the person can show his/her ID
//An example printout: Eligible to rent movies? false