This file contains hidden or 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 LruCache<T> { | |
private values: Map<string, T> = new Map<string, T>(); | |
private maxEntries: number = 20; | |
public get(key: string): T { | |
const hasKey = this.values.has(key); | |
let entry: T; | |
if (hasKey) { | |
// peek the entry, re-insert for LRU strategy |
This file contains hidden or 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/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
//Main function. The entry point for your Flutter app. | |
void main() { | |
runApp( | |
MaterialApp( | |
home: Scaffold( | |
body: DemoApp(), | |
), |