| Hit | Total | Coverage | |
|---|---|---|---|
| Lines | 7 | 7 | 100.0% |
| Functions | 0 | 0 | - |
| Branches | 0 | 0 | - |
| Line | Branch | Hits | Source code |
|---|---|---|---|
| 1 | import 'dart:collection'; |
||
| 2 | |
||
| 3 | class SerializationContext { |
||
| 4 | 4 | SerializationContext(bool Function(Object, Object) identical) |
|
| 5 | 4 | : _cache = HashMap(equals: identical); |
|
| 6 | |
||
| 7 | final HashMap<Object, Object> _cache; |
||
| 8 | |
||
| 9 | 4 | T? getReference<T extends Object>(Object data) { |
|
| 10 | 8 | final ref = _cache[data]; |
|
| 11 | 4 | return (ref is T) ? ref : null; |
|
| 12 | } |
||
| 13 | |
||
| 14 | 4 | void setReference<T extends Object>(Object data, T instance) { |
|
| 15 | 8 | _cache[data] = instance; |
|
| 16 | } |
||
| 17 | } |