App<T extends Object> class
The main class for a Patapata app. Typically passed to runApp. The main class for a Patapata-based application.
- Available extensions
Constructors
-
App.new({required T environment, required Widget createAppWidget(BuildContext context, App<
T> app), GlobalKey<State< ? providerKey, User userFactory(App<StatefulWidget> >T> app) = _sDefaultUserFactory, ErrorWidgetBuilder nonDebugErrorWidgetBuilder = _defaultNonDebugErrorWidgetBuilder, FutureOr<void> onInitFailure(T, dynamic, StackTrace)?, StartupSequence? startupSequence, Iterable<Plugin> ? plugins}) - Creates a new Patapata App. This is generally created in your main.dart files main function.
Properties
- analytics → Analytics
-
Use this to access the Analytics system for this App.
no setter
-
createAppWidget
→ Widget Function(BuildContext context, App<
T> app) -
The Widget ultimately passed in to flutter's runApp function.
If you are using the StandardAppPlugin, you usually return a
StandardMaterialApp or StandardCupertinoApp from this function.
final
- device → DeviceInfoPlugin
-
Access to information about the device that this application is running on.
no setter
- environment → T
-
The Environment object that will be accessible to all
Widgets via a
Provider
. This is also used to customize Plugins usually via a Mixin.final - hashCode → int
-
The hash code for this object.
no setterinherited
- localConfig → LocalConfig
-
Access to the LocalConfig system.
This particular LocalConfig acts as a proxy between
all of the LocalConfigs created from all initialized Plugins.
final
- log ↔ Log
-
Use this to access all the logging features of Patapata.
latefinal
-
Available on App<
The Navigator from StandardAppPlugin.delegate.Object> , provided by the StandardAppApp extensionno setter -
Available on App<
The BuildContext of the Navigator from StandardAppPlugin.delegate.Object> , provided by the StandardAppApp extensionno setter -
A list of all NavigatorObservers to use in a Navigator
from all the Plugins registered to this App.
The Analytics and StartupSequence system also relies on setting these to any
Navigators in the application.
no setter
- network → NetworkPlugin
-
Access to information about the network.
no setter
- nonDebugErrorWidgetBuilder → ErrorWidgetBuilder
-
The error widget to show in a non-debug build when
a FlutterError occurrs.
Default is to show nothing
const SizedBox.shrink()
.final -
onInitFailure
→ FutureOr<
void> Function(T, dynamic, StackTrace)? -
A callback that gets called when this App fails to initialize at any stage.
final
- package → PackageInfoPlugin
-
Access to information about this application's metadata.
no setter
- permissions → Permissions
-
Use this to access the Permissions system for this App.
no setter
- remoteConfig → RemoteConfig
-
Access to the RemoteConfig system.
This particular RemoteConfig acts as a proxy between
all of the RemoteConfigs created from all initialized Plugins.
final
- remoteMessaging → RemoteMessaging
-
Access to the RemoteMessaging system.
This particular RemoteMessaging acts as a proxy between
all of the RemoteMessagings created from all initialized Plugins.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stage → AppStage
-
The current stage of this App.
no setter
- standardAppPlugin → StandardAppPlugin
-
Available on App<
Retrieves StandardAppPlugin from the App.Object> , provided by the StandardAppApp extensionno setter - startupSequence → StartupSequence?
-
Access to the StartupSequence system.
If the app is rendering widgets using the StandardAppPlugin system,
StartupSequence.resetMachine is automatically executed only once when the app is launched.
final
- user → User
-
Gets the current User and if not yet created, creates one
via userFactory. If there is no userFactory set, creates
a default User.
no setter
-
userFactory
→ User Function(App<
T> app) -
A function that can create a custom User object or subclass for this App.
This is usually used to provide custom functions, properties, login methods
and such for your own application.
final
Methods
-
addPlugin(
Plugin plugin) → Future< void> - Adds a plugin to this App.
-
dispose(
) → void - Should be called when you want to get rid of this App and all resources associated with it, including static callbacks. Not usually needed in a real app, but used mostly in test tearDown.
-
environmentAs<
V> () → V? -
A helper function to attempt to cast environment as the given Type
V
. If environment is not aV
this function returns null. Useful for a Plugin to check an Environment supports that Plugins Mixin features. -
generateLink<
P extends StandardPage< (R> , R extends Object?>R pageData) → String? -
Available on App<
Retrieve a deep link for the specifiedObject> , provided by the StandardAppApp extensionpageData
(when the page that retrieves the deep link does not return a value).P
is the type of the destination page,R
is the type of page data, and they should be consistent with what you have set in your StandardPage. -
generateLinkWithResult<
P extends StandardPageWithResult< (R, E> , R extends Object?, E extends Object?>R pageData) → String? -
Available on App<
Retrieve a deep link for the specifiedObject> , provided by the StandardAppApp extensionpageData
(when the page that retrieves the deep link returns a value).P
is the type of the destination page,R
is the type of page data, andE
is the data type of the value that the page returns. These should be the same as what you set in your StandardPageWithResultFactory. -
getPlugin<
P> () → P? -
Attempts to get the given
P
Plugin or null if it doesn't exist. -
getPluginsOfType<
P> () → List< P> -
Gets a list of Plugins of type
P
. This is usually used to look for Plugins that have a specific Mixin to apply features to them. -
getProvider<
R> () → R - All providers registered inside of Patapata are accessible from with function, along with all providers above the providerKey given in this App's constructor if provided.
-
go<
T extends StandardPage< (R> , R extends Object?>R pageData, [ ]) → Future< void> -
Available on App<
Navigate to the StandardPageWithResult of typeObject> , provided by the StandardAppApp extensionT
that returns a value, with the option to passpageData
during the navigation.T
is the type of the destination page.R
is the type of page data.E
is the data type of the value that the page returns.navigationMode
is optional and represents the mode of StandardPageNavigationMode to use during navigation. -
goWithResult<
T extends StandardPageWithResult< (R, E> , R extends Object?, E extends Object?>R pageData, [ ]) → Future< E?> -
Available on App<
Navigate to the StandardPageWithResult of typeObject> , provided by the StandardAppApp extensionT
that returns a value, with the option to passpageData
during the navigation.T
is the type of the destination page.R
is the type of page data.E
is the data type of the value that the page returns.navigationMode
is optional and represents the mode of StandardPageNavigationMode to use during navigation. -
hasPlugin(
Type type) → bool - Returns true if the given Plugin type is currently registered.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeNativeSplashScreen(
) → Future< void> - Remove the native splash screen for this application.
-
removePlugin(
Plugin plugin) → Future< void> - Removes a plugin from this App.
-
removeRoute(
) → void -
Available on App<
Pops the Navigator of StandardAppApp.navigator. This is used when context is not accessible.Object> , provided by the StandardAppApp extension -
route(
String link) → void -
Available on App<
Navigate to a page with the specifiedObject> , provided by the StandardAppApp extensionlink
.link
is a string set in StandardPageFactory underlinks
. -
run(
[FutureOr< void> bootstrapCallback()?]) → Future<bool> - Run the app. Returns true if the app was successfully run.
-
runProcess<
R> (FutureOr< R> func()) → Future<R> -
Runs
func
in this Apps error Zone. Usually you do not need to use this. However in cases where you are executing code that was in or forked from the root Zone you may want to execute your code via this function to allow for Patapata to catch errors, logs, etc correctly. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
appStageChangeStream
→ Stream<
App< Object> > -
A Stream that can be listened to for global changes to all Apps that exist.
no setter
- debugIsWeb ↔ bool
-
getter/setter pair