SharkController class
Controller for Shark Widget UI, in order to control current widget
- Inheritance
-
- Object
- ChangeNotifier
- SharkController
Constructors
- SharkController.fromLocal({required String? source, required BuildContext context, bool handleClickEvent = true})
- Apply widget from local source
-
SharkController.fromUrl(BuildContext context, String _path, {Map<
String, dynamic> ? queryParams, Map<String, dynamic> ? header, bool handleClickEvent = true}) - Apply widget resource from remote source
Properties
- context ↔ BuildContext
-
current widget context
current context object must be under Navigator.
latefinal
- handleClickEvent ↔ bool
-
Whether shark should handle click event or not
including route, link event
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
queryParams
↔ Map<
String, dynamic> ? -
Request network params
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source ↔ String?
-
local source
getter/setter pair
- state → SharkWidgetState
-
Get current widget request state
no setter
-
stateStream
→ Stream<
SharkWidgetState> -
Get current state in stream
no setter
-
value
→ Map<
String, dynamic> ? -
Get current result value
Only if
_state == SharkWidgetState.success
would return a not null valueno setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addParse(
SharkParser parser) → void - Add custom parser to SharkWidget
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
get(
) → Future< void> - Fetch the network data on url: $hostUrl + path
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
parseEvent(
String? event) → void - Parse click event
-
redirect(
{required String path}) → Future< void> - Update current widget path & request a new widget
-
refresh(
) → Future< void> - refresh current page corresponds to the current path
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateHeader(
{required Map< String, dynamic> header}) → void - update current request header
-
updateParam(
{required Map< String, dynamic> params}) → void - update current request params
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited