Skip to content

Instantly share code, notes, and snippets.

@jasonmcaffee
jasonmcaffee / main.dart
Created January 25, 2023 16:19
Dart hashmap memoization
import 'dart:collection';
HashMap memoizedTextThemes = HashMap<String, String>();
abstract class PacificDesignSystem {
String get colorScheme;
String get textTheme {
if(memoizedTextThemes[colorScheme] == null){
memoizedTextThemes[colorScheme] = 'textTheme for $colorScheme';
@jasonmcaffee
jasonmcaffee / main.dart
Created August 16, 2022 18:34
decadent-flurry-9918
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
typedef void AddButtonPressed(int connectionAgg, VoidCallback preventDefaultBehavior);
'use strict';
//error is caught by the promise
function someSyncFunctionThrow(){
let promise = new Promise((resolve, reject)=>{
throw 'someSyncFunctionThrow error occurred!!!!';
resolve();
});
return promise;
}
alert('hello');