Client library for the Angel framework.
Switch branches/tags
Nothing to show
Clone or download
Latest commit ca68427 Nov 4, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib 2.0.0-alpha.2 Nov 4, 2018
test 2.0.0-alpha.2 Nov 4, 2018
web 2.0.0-alpha Aug 26, 2018
.DS_Store Restructured Sep 3, 2016
.babelrc More Dec 13, 2016
.gitignore 2.0.0-alpha Aug 26, 2018
.npmignore More Dec 13, 2016
.travis.yml Update .travis.yml Jul 9, 2018 2.0.0-alpha.2 Nov 4, 2018
LICENSE Initial commit Jun 23, 2016 Added ServiceList Dec 10, 2017
analysis_options.yaml 2.0.0-alpha Aug 26, 2018
build.yaml More DDC fixes Jun 23, 2018
dart_test.yaml 1.0.4 Mar 29, 2017
package.json More Dec 13, 2016
pubspec.yaml Expand http constraint Nov 4, 2018


Pub build status

Client library for the Angel framework. This library provides virtually the same API as an Angel server. The client can run in the browser, in Flutter, or on the command-line. In addition, the client supports angel_auth authentication.


// Choose one or the other, depending on platform
import 'package:angel_client/io.dart';
import 'package:angel_client/browser.dart';
import 'package:angel_client/flutter.dart';

main() async {
  Angel app = new Rest("http://localhost:3000");

You can call service to receive an instance of Service, which acts as a client to a service on the server at the given path (say that five times fast!).

foo() async {
  Service Todos = app.service("todos");
  List<Map> todos = await Todos.index();


The CLI client also supports reflection via json_god. There is no need to work with Maps; you can use the same class on the client and the server.

class Todo extends Model {
  String text;

  Todo({String this.text});

bar() async {
  // By the next release, this will just be:
  // app.service<Todo>("todos")
  Service Todos = app.service("todos", type: Todo);
  List<Todo> todos = await Todos.index();


Just like on the server, services support index, read, create, modify, update and remove.


Local auth:

var auth = await app.authenticate(type: 'local', credentials: {username: ..., password: ...});
print(; // User object

Revive an existing jwt:

Future<AngelAuthResult> reviveJwt(String jwt) {
  return app.authenticate(credentials: {'token': jwt});

Via Popup:

app.authenticateViaPopup('/auth/google').listen((jwt) {
  // Do something with the JWT

Resume a session from localStorage (browser only):

// Automatically checks for JSON-encoded 'token' in localStorage,
// and tries to revive it
await app.authenticate();


await app.logout();

Live Updates

Oftentimes, you will want to update a collection based on updates from a service. Use ServiceList for this case:

build(BuildContext context) async {
  var list = new ServiceList(app.service('api/todos'));
  return new StreamBuilder(
    stream: list.onChange,
    builder: _yourBuildFunction,