zugclient 0.0.3
zugclient: ^0.0.3 copied to clipboard
Flutter client framework for the ZugServ library
Basic Flutter/Dart Client Package for the ZugServ Library
Features #
Enables the rapid creation of a client to connect to and manage responses from a ZugServ.
Getting started #
For creating a ZugClient: pub get zugclient
For creating a ZugServ: https://github.com/JohnChernoff/ZugServ
Usage #
import 'package:flutter_test/flutter_test.dart';
import 'package:zugclient/oauth_client.dart';
import 'package:zugclient/zug_client.dart';
void main() {
test('construct a client', () {
TestClient testClient = TestClient("example.com", 80, "test");
testClient.currentArea = testClient.getOrCreateArea("testArea");
expect(testClient.currentArea.title, "testArea");
});
}
class TestArea extends Area {
TestArea(super.title);
}
enum TestServMsg {whee}
class TestClient extends ZugClient {
TestClient(super.domain, super.port, super.remoteEndpoint) {
addFunctions({
TestServMsg.whee.name: whee,
});
checkRedirect(OauthClient("lichess.org", "testClient"));
}
void whee(data) { print("Received message tyoe 'Whee' from Server"); }
@override
Area createArea(String title) {
return TestArea(title);
}
}
Additional information #
Very early version - project is rapidly developing, expect updates soon