Client
.NET/Unity C++/Unreal/Cocos2d-x JavaScript/Cocos2d-js Godot 3 Godot 4 Java/Android Defold cURL REST Swift Dart/Flutter
Server
TypeScript Go Lua
Client
# The Dart client is available from Heroic Labs. Contact us to request access.
Once you have received the client:
Add it into your Dart project’s lib folder. Import it into your project import 'hiro-client.dart'; Don’t forget to also import Nakama using import 'package:nakama/nakama.dart';
Setting up your initial script to run Hiro
# Define the global variables:
1
2
3
late final NakamaRestApiClient _nakamaAPIClient ;
late final HiroClient hiro ;
Session ? session ;
Initialize the Nakama RestAPI Client
1
2
3
4
5
6
7
const String host = "127.0.0.1" ;
const String serverKey = "defaultkey" ;
_nakamaAPIClient = NakamaRestApiClient . init ( host: host , serverKey: serverKey , ssl: false );
hiro = HiroClient ( _nakamaAPIClient );
To start making RPC calls, authenticate the client:
1
2
3
4
5
session = await _nakamaAPIClient . authenticateEmail (
email: 'test@example.com' ,
password: 'password123' ,
create: true
);
You are now able to use the Hiro Client, for example, to make an Economy Grant:
1
2
3
4
5
6
var request = EconomyGrantRequest ();
request . currencies = {
"coins" : "100"
};
var grant = await hiro . economyGrant ( session ! , request );