StandardPageWithResultFactory<T extends StandardPageWithResult<R, E>, R extends Object?, E extends Object?> class base

A factory class for creating StandardPageWithResult instances that returns a value E. This class can be added to the pages property of StandardMaterialApp.new or StandardCupertinoApp.new. T is the Represents the data type of the destination page, R is the Represents the data type of the page data, E is the Represents the data type of the value returned by the page.

For how to pass and configure this class in StandardStatefulMixin.pages, please refer to the documentation of StandardPageFactory.

The key distinction to StandardPage is that this class returns a value. For example, a PageWithResult is a screen of type StandardPageWithResult that returns a result of type String.

example:

class PageWithResult extends StandardPageWithResult<void, String> {
  @override
  Widget buildPage(BuildContext context) {
    return Scaffold(
      body: Center(
        child: TextButton(
          onPressed: () {
            // Set the result of this StandardPageWithResult to the pageResult.
            pageResult = 'pageResult';
            Navigator.pop(context);
          },
          child: const Text('Navigator Pop Page'),
        ),
      ),
    );
  }
}

You can retrieve the result of PageWithResult as shown below, using goWithResult for navigation.

example:

final tResult = await context.goWithResult<PageWithResult, void, String>(null);
Implementers

Constructors

StandardPageWithResultFactory.new({required T create(R pageData), Map<String, R Function(RegExpMatch match, Uri uri)>? links, String linkGenerator(R pageData)?, bool groupRoot = false, String? group = defaultGroup, bool keepHistory = true, bool enableNavigationAnalytics = true, StandardPageNavigationMode navigationMode = StandardPageNavigationMode.moveToTop, LocalKey pageKey(R pageData)?, StandardPageInterface<R, E> pageBuilder(Widget child, String? name, R pageData, LocalKey pageKey, String restorationId, GlobalKey<StandardPageWithResult<R, E>> standardPageKey, StandardPageWithResultFactory<StandardPageWithResult<R, E>, R, E> factoryObject)?, R pageDataWhenNull()?, String? pageName()?, String restorationId(R pageData)?, Type? parentPageType})
Create a StandardPageWithResultFactory. Define deep links for navigating to this page using regular expressions, allowing for multiple configurations. Set the page key, with page data being of the type R.

Properties

create → T Function(R pageData)
Creates the T page that this factory manages.
final
dataType Type
The data type of this page.
no setter
dataTypeIsNonNullable bool
Flag indicating that the type of page data set for this page is nullable.
no setter
enableNavigationAnalytics bool
Flag indicating whether to enable analytics for navigation.
final
group String?
The group name used to manage multiple pages as part of the same group when they exist.
final
groupRoot bool
Flag indicating whether to set this page as the root group if a group name is specified.
final
hashCode int
The hash code for this object.
no setterinherited
keepHistory bool
Flag indicating whether to stack this page as part of the history or not.
final
linkGenerator String Function(R pageData)?
The function to create deep links for this page. The return value must match the keys (regular expressions) passed to links and their corresponding R 'pageData' destinations.
final
The method for transitioning to this page from other pages. Please refer to StandardPageNavigationMode for navigation modes.
final
pageBuilder StandardPageInterface<R, E> Function(Widget child, String? name, R pageData, LocalKey pageKey, String restorationId, GlobalKey<StandardPageWithResult<R, E>> standardPageKey, StandardPageWithResultFactory<StandardPageWithResult<R, E>, R, E> factoryObject)?
A function for creating StandardPageInterface.
final
pageDataWhenNull → R Function()?
A function to generate a replacement value when the pageData passed during navigation is null.
final
pageName String? Function()?
The name of this page.
final
pageType Type
The page type of this page.
no setter
parentPageType Type?
When using nested Navigators, specifies what the parent page Type of this child page should be.
final
restorationId String Function(R pageData)?
A function for generating a value to pass to Page.restorationId.
final
resultType Type
The result type of this page.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

Returns the deep link generated by this page given pageData.
getPageKey(Object? pageData) LocalKey
Get the key set for this page, as configured for this page.
goWithResult(R pageData, [StandardPageNavigationMode? navigationMode]) Future<E?>
Navigate to the StandardPage of type T with the option to pass pageData during navigation. An optional navigationMode representing the mode of StandardPageNavigationMode to use during navigation can also be provided.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultGroup → const String
The default group name set when no group is specified for the page.