motor_flutter 0.3.3 copy "motor_flutter: ^0.3.3" to clipboard
motor_flutter: ^0.3.3 copied to clipboard

The Official Implementation of the Sonr Motor Node in Flutter. This package provides methods for Authentication, Data Management, and Wallet interactions for the Sonr Network.

Motor Flutter Banner

Pub

Flutter bindings for the Sonr Motor Node. See API Reference for more information.

Installation #

Integrating into your existing Flutter project

flutter pub add motor_flutter

or

dependencies:
  motor_flutter: ^0.3.2

iOS

Add the following to your Podfile:

platform :ios, '13.0'

Then remove this line from your Podfile:

use_frameworks!

Usage #

Here is a simple example of using the Motor class to control a motor.

import 'package:motor_flutter/motor_flutter.dart';

// Initialize the Sonr Motor Node
final instance = await MotorFlutter();

// Create a new account
instance.createAccount("secure-password-123", _handleResponse);

// Helper function to handle response
void _handleResponse(CreateAccountResponse? resp) {
  if (resp != null) {
    // Login to an existing account
    final authInfo = resp.authInfo;
    instance.login(authInfo, (response) {
      print(response);
    });
  }
}

We have also introduced a ModalView widget to make it easier to register and login to your account.

import 'package:motor_flutter/motor_flutter.dart';

// --
// 1. Create a basic button
// --
MaterialButton(
    color: Colors.black,
    child: const Text('Register Account'),

// --
// 2. Add the RegisterAccount ModalView on tap
// --
    onPressed: () async {
        final res = await MotorFlutter.to.showRegisterModal(onError: (err) {
            Get.snackbar("Error", err.toString());
        });
        if (res != null) {
            Get.offAll(() => const HomePage());
        }
    },
)

API Reference #

For full usage documentation on the Motor Flutter class, please see the API Reference.

Contributing #

See the contributing guide to learn how to contribute to the repository and the development workflow.

License #

MIT

5
likes
0
pub points
0%
popularity

Publisher

verified publishersonr.io

The Official Implementation of the Sonr Motor Node in Flutter. This package provides methods for Authentication, Data Management, and Wallet interactions for the Sonr Network.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (LICENSE)

Dependencies

device_info_plus, encrypt, fancy_password_field, fixnum, flutter, flutter_keychain, get, get_storage, logger, path_provider, plugin_platform_interface, protobuf, tuple

More

Packages that depend on motor_flutter