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);
Constructors
-
StandardPageWithResultFactory({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, List<StandardChildPageWithResultFactory< childPageFactories = const [], LocalKey pageKey(R pageData)?, StandardPageBuilder<StandardPageWithResult< >Object?, Object?> , Object?, Object?, Object?>R, E> ? pageBuilder, R pageDataWhenNull()?, String? pageName()?, String restorationId(R pageData)?}) -
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.const
Properties
- activeFirstNestedPage → bool
-
Flag indicating whether the first page in nestedPageFactories
should always be stacked as the first page of the nested Navigator.
no setter
-
Add to the deepest navigator when there are multiple nested navigators.
no setter
-
anyNestedPageFactories
→ List<
StandardPageWithResultFactory< StandardPageWithResult< >Object?, Object?> , Object?, Object?> -
The list of nested pages that can be used in any nested Navigator.
no setter
-
childPageFactories
→ List<
StandardChildPageWithResultFactory< StandardPageWithResult< >Object?, Object?> , Object?, Object?, Object?> -
The list of child pages that can be navigated to from this page.
final
- create → T Function(R pageData)
-
Creates the
Tpage 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
-
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
- hasChildPages → bool
-
Flag indicating whether there are child pages that can be navigated to from this page.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasNestedPages → bool
-
Flag indicating whether there are nested pages.
no setter
- 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.
final
-
The method for transitioning to this page from other pages.
Please refer to StandardPageNavigationMode for navigation modes.
final
-
The navigator page factory of this page, if any.
no setter
-
nestedPageFactories
→ List<
StandardPageWithResultFactory< StandardPageWithResult< >Object?, Object?> , Object?, Object?> -
The list of nested pages when using nested Navigators.
no setter
-
pageBuilder
→ StandardPageBuilder<
R, E> ? -
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
-
parentPageFactory
→ StandardPageWithResultFactory<
StandardPageWithResult< ?Object?, Object?> , Object?, Object?> -
The parent page factory of this page, if any.
no setter
- 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
-
createParentPageData(
R pageData) → Object? - When using child pages, specifies how to create the parent page data from the page data of this page.
-
generateLink(
Object? pageData) → String? -
Returns the deep link generated by this page for the given
pageData. -
getPageKey(
Object? pageData) → LocalKey - Get the key set for this page, as configured for this page.
-
goWithResult(
R pageData, [bool pushParentPage = false]) → Future< E?> -
Navigate to the StandardPage of type
Twith the option to passpageDataduring navigation. An optionalnavigationModerepresenting the mode of StandardPageNavigationMode to use during navigation can also be provided.pushParentPageindicates whether to push the parent page when navigating to a child page. default isfalse. -
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.