tru.ID SDK For Flutter
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.
To add the package
tru_sdk_flutter to your app project:
- Depend on it. Open the
pubspec.yamlfile located inside the app folder and add the following under the dependencies heading:
- 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.
For Android, this SDK requires a minimum API level of 21 (Android 5).
import 'package:trusdkflutter/trusdkflutter.dart'; // ... Trusdkflutter sdk = Trusdkflutter(); await sdk.check(checkUrl);
The SDK contains an embedded example to make building and testing the SDK bridge easier.
The example project is located in the
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 .
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
Don't forget to make sure Cocoapods installed on your machine.
- Initial implementation
Distributed under the MIT license. See
LICENSE for more information.