Files
softplayer-web/lib/core/grpc/grpc_channel_provider.dart
Nikolai Rodionov 09df205fdb
All checks were successful
ci/woodpecker/push/build Pipeline was successful
Start writing the web app
Signed-off-by: Nikolai Rodionov <allanger@posteo.com>
2026-05-27 16:08:53 +02:00

17 lines
460 B
Dart

import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:grpc/grpc_web.dart';
final grpcChannelProvider = Provider<GrpcWebClientChannel>((ref) {
String backendURL = dotenv.env['SOFTPLAYER_BACKEND_URL']!;
final GrpcWebClientChannel channel = GrpcWebClientChannel.xhr(
Uri.parse(backendURL),
);
ref.onDispose(() async {
await channel.shutdown();
});
return channel;
});