readStateData<T> method

T readStateData<T>({
  1. required BuildContext context,
  2. required String key,
  3. required T onNotFound(
    1. BuildContext context,
    2. String key
    ),
})

Implementation

T readStateData<T>({
  required BuildContext context,
  required String key,
  required T Function(BuildContext context, String key) onNotFound,
}) {
  try {
    return readState(context, identifier: key) as T;
  } catch (e) {
    return onNotFound(context, key);
  }
}