Added Flutter lib
This commit is contained in:
parent
25da3788f7
commit
e08aff9507
4 changed files with 24 additions and 6 deletions
|
@ -1,11 +1,11 @@
|
|||
# angel_client
|
||||
|
||||
[![pub 1.0.6](https://img.shields.io/badge/pub-1.0.6-brightgreen.svg)](https://pub.dartlang.org/packages/angel_client)
|
||||
[![Pub](https://img.shields.io/pub/v/angel_client.svg)](https://pub.dartlang.org/packages/angel_client)
|
||||
[![build status](https://travis-ci.org/angel-dart/client.svg)](https://travis-ci.org/angel-dart/client)
|
||||
|
||||
Client library for the Angel framework.
|
||||
This library provides virtually the same API as an Angel server.
|
||||
The client can run in the browser or on the command-line.
|
||||
The client can run in the browser, in Flutter, or on the command-line.
|
||||
In addition, the client supports `angel_auth` authentication.
|
||||
|
||||
# Usage
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/// Browser library for the Angel framework.
|
||||
/// Browser client library for the Angel framework.
|
||||
library angel_client.browser;
|
||||
|
||||
import 'dart:async' show Future, Stream, StreamController, StreamSubscription, Timer;
|
||||
import 'dart:convert' show JSON;
|
||||
import 'dart:html' show CustomEvent, window;
|
||||
import 'dart:html' show CustomEvent, Event, window;
|
||||
import 'package:http/browser_client.dart' as http;
|
||||
import 'angel_client.dart';
|
||||
// import 'auth_types.dart' as auth_types;
|
||||
|
@ -69,7 +69,8 @@ class Rest extends BaseAngelClient {
|
|||
timer.cancel();
|
||||
});
|
||||
|
||||
sub = window.on[eventName ?? 'token'].listen((CustomEvent e) {
|
||||
sub = window.on[eventName ?? 'token'].listen((Event ev) {
|
||||
var e = ev as CustomEvent;
|
||||
if (!ctrl.isClosed) {
|
||||
ctrl.add(e.detail);
|
||||
t.cancel();
|
||||
|
|
17
lib/flutter.dart
Normal file
17
lib/flutter.dart
Normal file
|
@ -0,0 +1,17 @@
|
|||
/// Flutter-compatible client library for the Angel framework.
|
||||
library angel_client.flutter;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'base_angel_client.dart';
|
||||
export 'angel_client.dart';
|
||||
|
||||
/// Queries an Angel server via REST.
|
||||
class Rest extends BaseAngelClient {
|
||||
Rest(String basePath) : super(new http.Client(), basePath);
|
||||
|
||||
@override
|
||||
Stream<String> authenticateViaPopup(String url, {String eventName: 'token'}) {
|
||||
throw new UnimplementedError('Opening popup windows is not supported in the `dart:io` client.');
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
name: angel_client
|
||||
version: 1.0.6
|
||||
version: 1.0.7
|
||||
description: Client library for the Angel framework.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/angel_client
|
||||
|
|
Loading…
Reference in a new issue