withAppEngineServices function Null safety

Future withAppEngineServices(
  1. Future callback(
      )
    )

    Runs callback inside a new service scope with appengine services added.

    The services available to callback are all non-request specific appengine services e.g. dbService.

    See package:gcloud/service_scope.dart for more information on service scopes.

    Here is an example on how this can be used:

    import 'dart:async';
    import 'dart:io';
    import 'package:appengine/appengine.dart';
    
    Future backgroundWork() {
      return dbService.query(Person).run().toList().then((persons) {
        // Do something with `persons`.
      });
    }
    
    void mainHandler(HttpRequest request) {
      dbService.query(Greeting).run().toList().then((greetings) {
        request.response
            ..write('Number of greetings: ${greetings.length}')
            ..close();
      });
    }
    
    main() {
      withAppEngineServices(() {
        return Future.wait([
           runAppEngine(mainHandler),
           backgroundWork(),
        ]);
      });
    }
    

    Implementation

    Future withAppEngineServices(Future callback()) {
      return appengine_internal.withAppEngineServices(callback);
    }