readState method

dynamic readState(
  1. BuildContext context, {
  2. Object? identifier,
})

Read given data from into this page storage bucket using the specified identifier or an identifier computed from the given context. The computed identifier is based on the PageStorageKeys found in the path from context to the PageStorage widget that owns this page storage bucket.

If an explicit identifier is not provided and no PageStorageKeys are found, then null is returned.

Implementation

dynamic readState(BuildContext context, { Object? identifier }) {
  if (_storage == null) {
    return null;
  }
  if (identifier != null) {
    return _storage![identifier];
  }
  final _StorageEntryIdentifier contextIdentifier = _computeIdentifier(context);
  return contextIdentifier.isNotEmpty ? _storage![contextIdentifier] : null;
}