getRestorationData method Null safety

Future<TestRestorationData> getRestorationData ()

Retrieves the current restoration data from the RestorationManager.

The returned TestRestorationData describes the current state of the widget tree under test and can be provided to restoreFrom to restore the widget tree to the state described by this data.

Implementation

Future<TestRestorationData> getRestorationData() async {
  assert(
    binding.restorationManager.debugRootBucketAccessed,
    'The current widget tree did not inject the root bucket of the RestorationManager and '
    'therefore no restoration data has been collected. Did you forget to wrap your widget tree '
    'in a RootRestorationScope?',
  );
  return binding.restorationManager.restorationData;
}