slerver_io 0.9.0 slerver_io: ^0.9.0 copied to clipboard
This plugin provides client way to interconnect flutter app.
SlerverIO #
This plugin provides client way to interconnect flutter app.
Learn more at Bixterprise.com
Usage #
Lets take a look at how to use SlerverIO
to connect two Flutter app for data sharing on both Android and iOS.
Create the client that we will use to connect.
SlerverIO client;
Initilialize response from flutter Server App.
initClient ( ) async {
client = await SlerverIO.connect('10.42.0.241', 9000, autoReconnect: true);
}
Now we add response triggers by using SlerverIORedirectRoute
from SlerverIO
onResponse ( ) {
var io = client.router;
io
..on('/name', (Map<String, dynamic> params) {
print(params['message']);
})
..on('/surname', (List params) {
print('${params.first} => ${params.last}');
})
..on('connect', () {
print('Connected successfully');
});
}
Now lets define function uses to send data to server
writeSomething() {
client
..send({
'path': '/register',
'params': {'name': 'Bakop', 'surname': 'Champlain'}
})
..send({
'path': '/findAll',
'params': ['Champlain', 'Manuel', 'Cabrel', 'Jordan']
});
}