MotorFlutter class Null safety
MotorFlutter
This is the main class for the MotorFlutter package. Create a new MotorFlutter instance by calling the MotorFlutter.init method in your main method.
Resources
- Inheritance
-
- Object
- GetLifeCycle
- DisposableInterface
- GetxService
- MotorFlutter
- Available Extensions
Constructors
Properties
- address → RxString
-
Reactive variable that holds the current active MotorFlutter wallet address.
final
-
Sets itself to true when the MotorFlutter account is created with createAccount, or login. This is used to
determine if the user is ready to be active on the Sonr Network or not.
final
- balance → RxInt
-
Returns the current active account's liquid SNR balance. This variable is triggered to refresh on the stat method.
final
- connected → RxBool
-
Sets itself to true when the MotorFlutter account is finished bootstrapping to the Sonr Network. The connect method triggers the refresh of this variable.
final
-
didDocument
→ Rx<
DIDDocument> -
Returns the curret active account's
DIDDocument
. This value is set on account authorization, and can be refreshed with the stat method.final - didUrl → String
-
This getter method returns the current version of the underlying accounts DIDDocument id. This is NOT a reactive variable.
read-only
-
discoverEvents
→ StreamController<
RefreshEvent> -
A Stream of all
RefreshEvent
that are transmitted in the Local Discovery OLCfinal -
domains
→ RxList<
Alias> -
A list of .snr/ domains each mapped to
Alias
objects. These can be used to resolve associated aliases with a given Sonr account.final - hashCode → int
-
The hash code for this object.
read-only, inherited
- initialized → bool
-
Checks whether the controller has already been initialized.
read-only, inherited
- isClosed → bool
-
Checks whether the controller has already been closed.
read-only, inherited
-
nearbyPeers
→ RxList<
Peer> -
List of all neerby Motor powered devices. This is updated every time a RefreshEvent is received on the MethodChannel. All nodes are referenced with the
Peer
object.final -
onDelete
→ InternalFinalCallback<
void> -
Internal callback that starts the cycle of this controller.
final, inherited
-
onStart
→ InternalFinalCallback<
void> -
Called at the exact moment the widget is allocated in memory.
It uses an internal "callable" type, to avoid any @overrides in subclases.
This method should be internal and is required to define the
lifetime cycle of the subclass.
final, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
-
schemaMap
→ RxMap<
String, SchemaDocument> -
A Reference Map for all recently queried SchemaDefinitions, and all created
SchemaDocument
s.final - staked → RxString
-
Returns the current accounts staked SNR balance. This variable is triggered to refresh on the stat method.
final
Methods
-
$configureLifeCycle(
) → void -
inherited
-
buyAlias(
String alias, [ResponseCallback< MsgBuyAliasResponse> ? callback]) → Future<MsgBuyAliasResponse?> -
Purchases a new .snr/ domain for the current account if the
alias
is available. A succesful transaction will return aMsgBuyAliasResponse
. -
connect(
[ResponseCallback< bool> ? callback]) → Future<bool> -
Establishes the Motor libp2p node, bootstraps the node to known DHT peers, and begins listening for incoming connections. An optional
callback
can be provided to be notified when the node is ready to accept connections. -
createAccount(
String password) → Future< CreateAccountResponse?> -
Creates a new Account with the given
password
. This process generates a two random 32 byte keys and stores them in the keychain during production and in the temporary storage during development. ReturnsCreateAccountResponse
if the account is created successfully. -
createSchema(
String label, Map< String, SchemaKind> fields, Map<String, String> ? metadata, [ResponseCallback<CreateSchemaResponse> ? callback]) → Future<CreateSchemaResponse?> -
Builds a request for recording a SchemaDefinition on the blockchain.
metadata
is for any additional information that should be stored with the schema.callback
is an optional function that will be called when the transaction is complete. Returns aCreateSchemaResponse
if the transaction is successful. -
findBucket(
{String? did, String? creator}) → Future< List< WhereIs> ?> -
Queries the Sonr blockchain for the associated WhereIs for the provided
did
orcreator
. Ifdid
is provided a single-value list is returned (if successful), and thecreator
argument will be ignored. ReturnsList<WhereIs>
if bucket(s) are found. Returns null if no bucket is found, or if neitherdid
norcreator
were provided. -
findSchemas(
{String? did, String? creator}) → Future< Map< String, SchemaDefinition> ?> -
Searches for a schema by either its
did
orcreator
. Ifdid
is provided a single-value map is returned, and thecreator
argument will be ignored. Returns a map of String to SchemaDefinition if definition(s) are found. Returns null if no definition is found, or if neitherdid
norcreator
were provided. -
login(
{required String password, required String address}) → Future< LoginResponse?> -
Logs in to an existing account with the given
password
. During production, this method retrieves the keys from the keychain usingaddress
. Both of these params are required in order to return a successfulLoginResponse
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
onClose(
) → void -
Called before onDelete method. onClose might be used to
dispose resources used by the controller. Like closing events,
or streams before the controller is destroyed.
Or dispose objects that can potentially create some memory leaks,
like TextEditingControllers, AnimationControllers.
Might be useful as well to persist some data on disk.
override
-
onInit(
) → void -
Called immediately after the widget is allocated in memory.
You might use this to initialize something for the controller.
@mustCallSuper, inherited
-
onReady(
) → void -
Called 1 frame after onInit(). It is the perfect place to enter
navigation events, like snackbar, dialogs, or a new route, or
async request.
inherited
-
sellAlias(
String alias, int amount, [ResponseCallback< MsgSellAliasResponse> ? callback]) → Future<MsgSellAliasResponse?> -
Lists an existing
alias
owned by the current account for sale at the givenamount
. The minimum price for an Alias is 10.0 SNR. A succesful transaction will return aMsgSellAliasResponse
. -
sendTokens(
String recipient, int amount, {String memo = ""}) → Future< PaymentResponse?> -
Creates a TX in order to deposit the
amount
of SNR into therecipient
account. A succesful transaction will return aPaymentResponse
and will return null if the transaction fails. -
stat(
[ResponseCallback< StatResponse> ? callback]) → Future<StatResponse?> -
Refreshes the current instances values of address,
domain
, didDocument, balance, didUrl, and staked with the latest values from the blockchain. An optionalcallback
can be provided to be notified when the refresh is complete. -
toString(
) → String -
A string representation of this object.
inherited
-
transferAlias(
String alias, String currentOwner, int amount, [ResponseCallback< MsgTransferAliasResponse> ? callback]) → Future<MsgTransferAliasResponse?> -
Transfers an existing
alias
listed for sale from the account which listed it, to the current active account. A succesful transaction will return aMsgTransferAliasResponse
, and will return an error if the providedamount
is less than the listed price, or if thealias
is not listed for sale by thecurrentOwner
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- isReady → bool
-
Returns true if the MotorFlutter service has been injected into the GetX State Management system.
read-only
- to → MotorFlutter
-
Use the static to getter method allows access to MotorFlutter instance anywhere in the application.
read-only
Static Methods
-
init(
) → Future< void> - This static method initializes a MotorFlutter instance and Injects it into Get state management.