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({required T environment, required Widget createAppWidget(BuildContext context, App<T> app), GlobalKey<State<StatefulWidget>>? providerKey, User userFactory(App<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
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
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 a V this function returns null. Useful for a Plugin to check an Environment supports that Plugins Mixin features.
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.
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.
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