serviced 1.0.1 copy "serviced: ^1.0.1" to clipboard
serviced: ^1.0.1 copied to clipboard

Basic Service Management

Basic Service management for dart

Features #

  • Lazy Services
  • Auto Start Services
  • Async Startup

Getting started #

import 'package:serviced/serviced.dart';

// This is a stateless service singleton
class TestStatelessService extends StatelessService {}

class TestService extends Service {
  @override
  void onStart() {
    // Called before the service is started
  }

  @override
  void onStop() {
    // Called before the service is stopped
  }
}

void main() async {
  // Register services here
  services().register(() => TestService());

  // This service will be started automatically
  services().register(() => TestStatelessService(), lazy: false); 
  
  // Start all services that are not lazy
  await services().waitForStartup();
  runApp(YourApp());
}

0
likes
130
points
86
downloads

Publisher

verified publisherarcane.art

Weekly Downloads

Basic Service Management

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

fast_log, precision_stopwatch

More

Packages that depend on serviced