tru.ID SDK For Flutter
Getting Started
Before you begin, you will need to:
- For iOS: Xcode 12+ required
- For Android: Android Studio version 3.0 or later
- A mobile phone with mobile data connection.
- Install Flutter
Installation
To add the package tru_sdk_flutter
to your app project:
- Depend on it. Open the
pubspec.yaml
file located inside the app folder and add the following under the dependencies heading:
`tru_sdk_flutter: ^0.1.5`
- Install it
- From the terminal: Run:
flutter pub get
- From Android Studio/IntelliJ: Click Packages get in the action ribbon at the top of pubspec.yaml.
- From VS Code: Click Get Packages located in right side of the action ribbon at the top of pubspec.yaml.
Compatibility
For Android, this SDK requires a minimum API level of 21 (Android 5).
Usage
import 'package:tru_sdk_flutter/tru_sdk_flutter.dart';
// ...
TruSdkFlutter sdk = TruSdkFlutter();
await sdk.checkUrlWithResponseBody(checkUrl);
Example Demo
The SDK contains an embedded example to make building and testing the SDK bridge easier.
The example project is located in the example
directory.
This SDK uses the tru.ID dev server as the example server. To get setup:
Create a tru.ID account.
Install the tru.ID CLI via:
npm i -g @tru_id/cli
Set up the CLI with the tru.ID credentials which can be found within the tru.ID console.
Install the tru.ID CLI development server plugin.
Create a new tru.ID project within the root directory via:
tru projects:create flutter-sdk-server --project-dir .
Run the development server, pointing it to the directory containing the newly created project configuration. This will also open up a localtunnel to your development server, making it publicly accessible to the Internet so that your mobile phone can access it when only connected to mobile data.
tru server -t --project-dir .
In example/lib/main.dart
, replace base_url
with your development server URL.
It may be a good idea to work on the native Android or iOS example projects in separate windows/IDEs. Android Studio will provide a banner suggesting this.
Android Example Project
tru-sdk-flutter/example/android
iOS Example
tru-sdk-flutter/example/ios
Don't forget to make sure Cocoapods installed on your machine and install pods to example.
cd ios
pod install
Troubleshooting
Meta
Distributed under the MIT license. See LICENSE
for more information.
https://github.com/tru-ID
license-image
: https://img.shields.io/badge/License-MIT-blue.svg
license-url
: LICENSE