useRefValue<T> function
- T value
Simple wrapper around useRef, but emitting value instead of ObjectRef.
Use this in case you want a singleton instance of some class or other data structur.
final singletonValue = useRefValue(Singleton());
Implementation
T useRefValue<T>(T value) {
final ref = useRef(value);
return ref.value;
}