shelf_hotreload 0.0.2 copy "shelf_hotreload: ^0.0.2" to clipboard
shelf_hotreload: ^0.0.2 copied to clipboard

Wrapper to easily enable hot-reload for shelf applications.

Wrapper to easily enable hot-reload for shelf applications.

Usage #

import 'dart:io';

import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as io;
import 'package:shelf_hotreload/shelf_hotreload.dart';

// Run this app with --enable-vm-service (or use debug run)
void main() async {
  withHotreload(() => createServer());
}

Future<HttpServer> createServer() {
  var handler = (shelf.Request request) => shelf.Response.ok('hot!');
  return io.serve(handler, 'localhost', 8080);
}

In order to enable hot-reload, you need to run your Dart application with --enable-vm-service. For example:

dart --enable-vm-service path/to/app.dart

Important: Your app will work nevertheless, even if you omit the flag.

53
likes
130
pub points
85%
popularity

Publisher

verified publisherfelix-blaschke.de

Wrapper to easily enable hot-reload for shelf applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

hotreloader

More

Packages that depend on shelf_hotreload