debugIsSerializableForRestoration function
- Object? object
Returns true when the provided object is serializable for state
restoration.
Should only be called from within asserts. Always returns false outside of debug builds.
Implementation
bool debugIsSerializableForRestoration(Object? object) {
  bool result = false;
  assert(() {
    try {
      const StandardMessageCodec().encodeMessage(object);
      result = true;
    } catch (error) {
      // This is only used in asserts, so reporting the exception isn't
      // particularly useful, since the assert itself will likely fail.
      result = false;
    }
    return true;
  }());
  return result;
}