This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Let's examine how the Apollo cache layers optimistic data, primarily from the performTransaction API: | |
https://github.com/apollographql/apollo-client/blob/master/src/cache/inmemory/inMemoryCache.ts#L255 | |
When executing a transaction like writing an optimistic mutation result, it will first call `addLayer` on its optimisticData. | |
This will create a new layer which as it is instantiated, calls the `perform` function that was passed to it. It stores a reference to the layer that instantiated it as its parent. | |
Perform is called with the newly instantiated layer. It sets both the data reference and optimisticData reference equal to the new layer instance, so that any changes to data or optimisticData that occur during the transaction are set onto the new layer and not its parent and not the root entity store. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ColorExtensions on Color { | |
String toHex() => | |
'#${(value & 0xFFFFFF).toRadixString(16).padLeft(6, '0').toUpperCase()}'; | |
bool get isDark { | |
return ThemeData.estimateBrightnessForColor(this) == Brightness.dark; | |
} | |
Color darken([int percent = 10]) { | |
assert(1 <= percent && percent <= 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ZodTypeAny, z } from "zod"; | |
import { | |
DeploymentOptions, | |
FunctionBuilder, | |
https, | |
} from "firebase-functions/v1"; | |
import { assert, validate } from "./validate.js"; | |
import Logger from "./logger.js"; | |
const logger = new Logger("Precheck"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController<T> extends ComputableSubscriber<T> { | |
ViewController({ | |
super.initialValue, | |
super.broadcast, | |
}); | |
T get model { | |
return get(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class FState<T extends Widget> extends StatefulWidget { | |
final T scoped; | |
final Widget Function(T widget, void Function(VoidCallback)) Function() | |
builder; | |
const FState(this.scoped, this.builder, {super.key}); | |
@override |
OlderNewer