22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
5- library appengine.internal;
65
76import 'dart:async' ;
87import 'dart:io' ;
@@ -33,7 +32,7 @@ bool _loggingPackageEnabled = false;
3332
3433/// Runs the given [callback] inside a new service scope and makes AppEngine
3534/// services available within that scope.
36- Future withAppEngineServices (Future callback () ) =>
35+ Future withAppEngineServices (Future Function () callback ) =>
3736 _withAppEngineServicesInternal ((_) => callback ());
3837
3938/// Runs the AppEngine http server and uses the given request [handler] to
@@ -42,11 +41,11 @@ Future withAppEngineServices(Future callback()) =>
4241/// The given request [handler] is run inside a new service scope and has all
4342/// AppEngine services available within that scope.
4443Future runAppEngine (
45- void handler (HttpRequest request, ClientContext context),
46- void onError (Object e, StackTrace s)? , {
44+ void Function (HttpRequest request, ClientContext context) handler ,
45+ void Function (Object e, StackTrace s)? onError , {
4746 int port = 8080 ,
4847 bool shared = false ,
49- void onAcceptingConnections (InternetAddress address, int port)? ,
48+ void Function (InternetAddress address, int port)? onAcceptingConnections ,
5049}) {
5150 return _withAppEngineServicesInternal ((ContextRegistry contextRegistry) {
5251 final appengineServer = AppEngineHttpServer (contextRegistry,
@@ -97,7 +96,7 @@ Future runAppEngine(
9796}
9897
9998Future _withAppEngineServicesInternal (
100- Future callback (ContextRegistry contextRegistry)) {
99+ Future Function (ContextRegistry contextRegistry) callback ) {
101100 return ss.fork (() async {
102101 final ContextRegistry contextRegistry = await _initializeAppEngine ();
103102 final bgServices = contextRegistry.newBackgroundServices ();
@@ -130,7 +129,7 @@ Future<ContextRegistry> _initializeAppEngine() async {
130129 zoneId ?? = 'dev-machine' ;
131130 final bool isProdEnvironment = ! isDevEnvironment;
132131
133- String ? _findEnvironmentVariable (String name,
132+ String ? findEnvironmentVariable (String name,
134133 {bool onlyInProd = false , bool onlyInDev = false , bool needed = true }) {
135134 if (onlyInProd && ! isProdEnvironment) return null ;
136135 if (onlyInDev && ! isDevEnvironment) return null ;
@@ -142,23 +141,23 @@ Future<ContextRegistry> _initializeAppEngine() async {
142141 return value;
143142 }
144143
145- final projectId = _findEnvironmentVariable (
144+ final projectId = findEnvironmentVariable (
146145 'GOOGLE_CLOUD_PROJECT' ,
147146 needed: true ,
148147 )! ;
149148
150149 // For local testing the gcloud sdk brings now a gRPC-ready datastore
151150 // emulator which will tell the user to use this environment variable.
152- final dbEmulatorHost = _findEnvironmentVariable ('DATASTORE_EMULATOR_HOST' ,
151+ final dbEmulatorHost = findEnvironmentVariable ('DATASTORE_EMULATOR_HOST' ,
153152 onlyInDev: false , needed: false );
154153
155154 final serviceId =
156- _findEnvironmentVariable ('GAE_SERVICE' , onlyInProd: true , needed: true ) ??
155+ findEnvironmentVariable ('GAE_SERVICE' , onlyInProd: true , needed: true ) ??
157156 'dummy-service' ;
158157 final versionId =
159- _findEnvironmentVariable ('GAE_VERSION' , onlyInProd: true , needed: true ) ??
158+ findEnvironmentVariable ('GAE_VERSION' , onlyInProd: true , needed: true ) ??
160159 'dummy-version' ;
161- final instance = _findEnvironmentVariable ('GAE_INSTANCE' ,
160+ final instance = findEnvironmentVariable ('GAE_INSTANCE' ,
162161 onlyInProd: true , needed: true ) ??
163162 'dummy-instance' ;
164163
0 commit comments