Skip to main content

Setup your Project

The Motor SDK is a set of developer tools for building decentralized applications on the Sonr network. It currently supports Flutter (iOS, Android, MacOS) with plans to support Javascript, React Native, and Web in the future.

Motor Flutter is a Flutter library designed to help developers utilize Sonr in their apps. You can find the package at motor.build.

Install Speedway

Install the Speedway CLI and (optionally) UI following Install Speedway CLI and running Speedway UI.

Install Motor SDK

Select your target platform to get started and setup a new Motor integrated project.

tip

Make sure you have the latest version of XCode installed from the Mac App Store.

1. Add the dependency

Add motor_flutter as a dependency in your existing project:

flutter pub add motor_flutter

or add it to your pubspec.yaml file:

dependencies:
motor_flutter: ^0.9.1

Platform-Specific Setup

If you want to integrate Apple devices (iOS, MacOS) into your project, you will need to modify the following:

Add the following to the top of your ios/Podfile:

platform :ios, '13.0'

Then, remove the following line from your ios/Podfile:

use_frameworks!

Start the Motor Node

Spawning a new Motor instance is the first step in using the SDK. This is where you'll configure your app's connection to the Sonr network.

The Motor Flutter SDK uses the GetX package to manage state. This means that you must wrap the MotorFlutter service into the Get.putAsync method. For more information on this, please refer to their documentation.

import 'package:motor_flutter/motor_flutter.dart';

// Modify the main method to be Future<void>
Future<void> main() async {
// Init method sets up State Management with GetX and ensures that Widgets are
// rendered before the Motor Node is ready.
await MotorFlutter.init();

// Start your App like normal
runApp(const MyApp());
}

Next Steps

You're ready to start using Motor in your app! Check out one of the guides for next steps.