serve library Null safety

Provides the features needed to execute Cloud Functions.

Typically, this library is imported in bin/server.dart or similar.

While it's possible to use this library from hand-written code, you should use package:functions_framework_builder to generate server code instead.


JsonFunctionTarget<RequestType, ResponseType>
JsonWithContextFunctionTarget<RequestType, ResponseType>


serve(List<String> args, FunctionTarget? nameToFunctionTarget(String)) Future<void>
If there is an invalid configuration, BadConfigurationException will be thrown.

Exceptions / Errors

When thrown in a request handler, causes a response with a status code statusCode to be returned.