Update dart/basics.md (#1145)

Don't reference deprecated constructor.
This commit is contained in:
Slava Egorov 2023-06-15 18:30:25 +02:00 committed by GitHub
parent 3949560476
commit 7b61c07f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -351,7 +351,7 @@ do this for our `RouteGuide` service:
```dart ```dart
Future<void> main(List<String> args) async { Future<void> main(List<String> args) async {
final server = grpc.Server([RouteGuideService()]); final server = grpc.Server.create([RouteGuideService()]);
await server.serve(port: 8080); await server.serve(port: 8080);
print('Server listening...'); print('Server listening...');
} }
@ -359,7 +359,7 @@ Future<void> main(List<String> args) async {
To build and start a server, we: To build and start a server, we:
1. Create an instance of the gRPC server using `grpc.Server()`, 1. Create an instance of the gRPC server using `grpc.Server.create()`,
giving a list of service implementations. giving a list of service implementations.
1. Call `serve()` on the server to start listening for requests, optionally passing 1. Call `serve()` on the server to start listening for requests, optionally passing
in the address and port to listen on. The server will continue to serve requests in the address and port to listen on. The server will continue to serve requests