FairApp class

Application which can update the widget tree through bundle file.

Use bundleAlias to declare a map of local DSL assets.

The bundleProvider can be setup to a custom instance of BundleLoader, so you can handle the process of bundle loading. eg:

  • redirect http request to native-side
  • add inApp headers
  • add cache-layer to both local assets and http resource

Example:

FairApp(
  child: MaterialApp(
    child: Scaffold(
      appBar: AppBar(title: const Text('FairDemo')
    ),
  )
)

Also see:

Inheritance

Constructors

FairApp({Key? key, required Widget child, Map<String, String>? bundleAlias, FairRouteBuilder? routeBuilder, BundleLoader? bundleProvider, bool debugShowFairBanner = true, bool profile = false, WidgetBuilder? placeholder, Map<String, FairDelegateBuilder>? delegate, Map<String, FairModuleBuilder>? modules, GeneratedModule? generated, HttpDecoder? httpDecoder, List<DynamicWidgetBuilderFunction?>? dynamicWidgetBuilder})
Construct new instance of FairApp

Properties

bindData Map<String, BindingData>
finalinherited
bundleAlias Map<String, String>?
Remote or local bundle assets. The key should be unique tag name while value represent binary resource for layout, such as assets path or url.
final
bundleProvider BundleLoader?
Provide custom bundle loader
final
child Widget
The widget below this widget in the tree.
finalinherited
debugShowFairBanner bool
Turns on a little "Fair" banner in checked mode to indicate that the app is using Fair SDK. This is on by default (in checked mode), to turn it off, set the constructor argument to false. In release mode this has no effect.
final
dynamicWidgetBuilder List<DynamicWidgetBuilderFunction?>?
Define a custom DynamicWidgetBuilder to solve special case
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
httpDecoder → HttpDecoder?
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
modules → FairModuleRegistry
finalinherited
placeholderBuilder WidgetBuilder?
Optional, provide the loading widget before real content is ready.
final
proxy → P
no setterinherited
routeBuilder FairRouteBuilder?
Provide custom router when Fair notify a named route event.
final
runtime Runtime
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() InheritedElement
Inflates this configuration to a concrete instance.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pathOfBundle(String tag) String?
register(FairState state) Future
inherited
setup(bool profile, Map<String, FairDelegateBuilder>? builder, GeneratedModule? generated, Map<String, FairModuleBuilder>? module) → void
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited
unregister(FairState state) → void
inherited
updateShouldNotify(covariant InheritedWidget oldWidget) bool
Whether the framework should notify widgets that inherit from this widget.
override

Operators

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

Static Methods

initFairLibraryAdapter(Widget app, {Map<String, IFairPlugin>? plugins, Map<String, String>? jsPlugins, List<IFairLibraryAdapter>? adapters}) → void
app FairApp plugins Fair plugin code with Dart jsPlugins Fair plugin code with JavaScript adapters 3rd-party libraries which adapted Fair
of(BuildContext? context, {bool rebuild = false}) FairApp?
runApplication(Widget app, {Map<String, IFairPlugin>? plugins, Map<String, String>? jsPlugins, String? package, List<String>? baseJsSources, List<IFairLibraryAdapter>? adapters}) → void