F
Flint DartDocs
GitHub

API Reference

Auth Guards

Focused reference for Flint Dart and Flint UI APIs, with copyable examples and practical notes.

Auth Guards

Protect routes with middleware and request auth helpers.

Flint does not require a separate guard system. Use middleware and ctx.req.user to enforce access.

Example

CodeBlock dart
class AuthGuard extends Middleware {
  @override
  Handler handle(Handler next) {
    return (Context ctx) async {
      final user = await ctx.req.user;
      if (user == null) {
        return ctx.res.status(401).json({'error': 'Unauthorized'});
      }
      return next(ctx);
    };
  }
}

app.get('/dashboard', (Context ctx) async => ctx.res.send('ok'))
  .useMiddleware(AuthGuard());
F
Flint DartBackend framework and Dart UI docs

Build routes, controllers, APIs, docs, and browser UI from one Dart-shaped stack.

Controllers
OpenAPI
Flint UI
Copyright 2024 Flint Dart. Maintained by Eulogia Technologies.
v 1.1.14
MIT License
Built with Dart