Skip to content

Instantly share code, notes, and snippets.

View Quingsley's full-sized avatar
🎯
Focusing

JEROME JUMAH Quingsley

🎯
Focusing
View GitHub Profile
@Quingsley
Quingsley / main.dart
Created September 10, 2022 04:23
jade-tundra-8183
void main() {
List<Meal> meals = [
Meal(
id: 'm1',
categories: [
'c1',
'c2',
],
title: 'Spaghetti with Tomato Sauce',
affordability: Affordability.affordable,
@Quingsley
Quingsley / main.dart
Created September 1, 2022 12:06
bustling-gust-3556
import 'dart:math';
void main() {
final List<Transactions> transactions = [
Transactions(
'1', 'Shoes', 2500.34, DateTime.now()),
Transactions('3', 'Bag', 1500, DateTime.now()),
];
var id = Random().nextInt(100) + 900;
print(id);
@Quingsley
Quingsley / index.html
Last active August 27, 2022 08:40
validation
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>validation</title>
<link rel="stylesheet" href="styles.css">
<script type="application/dart" src="main.dart"></script>
</head>
@Quingsley
Quingsley / main.dart
Last active August 27, 2022 08:03
playing with unsplash
import 'dart:convert';
import 'dart:math';
import 'package:http/http.dart' show get;
void main() async {
final clientID = 'ha_NzNADHFGe6F3m0BDREK-WDj8mqABkeRTYW8JFhFk';
final response = await get(Uri.parse('https://api.unsplash.com/photos?client_id=$clientID'));
//print(jsonDecode(response.body));
var result = ImageModel.fromJson(jsonDecode(response.body));
print(result.url);
print('This are the likes: $result');
@Quingsley
Quingsley / index.html
Last active August 17, 2022 14:04
more-streams
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>more-streams</title>
<link rel="stylesheet" href="styles.css">
<script type="application/dart" src="main.dart"></script>
</head>
@Quingsley
Quingsley / main.dart
Created August 17, 2022 07:51
streams
import 'dart:async';
void main() {
final controller = StreamController();
final order = Order('chocolate');
final baker = StreamTransformer.fromHandlers(
handleData:(cakeType,sink){
if(cakeType == 'chocolate'){
sink.add(Cake());
}else {
@Quingsley
Quingsley / main.dart
Last active August 17, 2022 07:51
streams
import 'dart:async';
void main() {
final controller = StreamController();
final order = Order('chocolate');
final baker = StreamTransformer.fromHandlers(
handleData:(cakeType,sink){
if(cakeType == 'chocolate'){
sink.add(Cake());
}else {
@Quingsley
Quingsley / main.dart
Created August 11, 2022 15:59
magenta-cloud-5558
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
@Quingsley
Quingsley / main.dart
Created August 11, 2022 15:16
working-with-json-data
import 'dart:convert';
void main() {
// this represents some response data we get from the network
final jsonData = '{ "name": "Pizza da Mario", "cuisine": "Italian" }';
// 2. decode the json
final parsedJson = jsonDecode(jsonData);
// 3. print the type and value
print('${parsedJson.runtimeType} : $parsedJson');
@Quingsley
Quingsley / main.dart
Last active August 22, 2022 13:35
working-with-json-data
import 'dart:convert';
import 'package:http/http.dart' show get;
void main() async {
final clientID = 'ha_NzNADHFGe6F3m0BDREK-WDj8mqABkeRTYW8JFhFk';
final response = await get(Uri.parse('https://api.unsplash.com/photos?client_id=$clientID'));
//print(jsonDecode(response.body));
var result = ImageModel.fromJson(jsonDecode(response.body));
// print(result.url);
// print(result.tag);
print(result.imageUrl);