You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Undefined name 'GrpcServiceName' used as an annotation.
Try defining the name or importing it from another library.dartundefined_annotation
None solution awailable now
In this last file named contrat.pbgrpc.dart, the annotation
@$pb.GrpcServiceName is not recognized
As $pb is a reference on protobuf.dart, it seems to create this ticket on protobuf github rather than grpc github
Best regards,
Stéphane
The text was updated successfully, but these errors were encountered:
Interestingly enough, I see protobuf: ^2.1.0 in the first comment, but we just recently published 3.0.0; I would have thought this issue was from the 3.0.0 version just from the timing.
On Vscode
Undefined name 'GrpcServiceName' used as an annotation.
Try defining the name or importing it from another library.dartundefined_annotation
None solution awailable now
settings for reproduce
name: my_server
description: A sample command-line application.
version: 1.0.0
publish_to: none
environment:
sdk: '>=2.19.6 <3.0.0'
dependencies:
analyzer: ">=2.0.0 <6.0.0"
grpc: ^3.1.0
protobuf: ^2.1.0
isar: 3.1.0+1
isar_generator: 3.1.0+1
build_runner: ^2.3.3
path: ^1.8.3
dev_dependencies:
lints: ^2.0.0
flutter doctor -v
[✓] Flutter (Channel stable, 3.7.12, on Debian GNU/Linux 12 (bookworm) 6.1.0-9-cloud-amd64, locale fr_FR.UTF-8)
• Flutter version 3.7.12 on channel stable at /home/debian/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4d9e56e694 (il y a 8 semaines), 2023-04-17 21:47:46 -0400
• Engine revision 1a65d409c7
• Dart version 2.19.6
• DevTools version 2.20.1
on my_server/protos
syntax = "proto3";
package trvmyserver;
service ContratMethods {
rpc CreateContrat(Contrat) returns (Contrat);
rpc GetAllContrats(Empty) returns (Contrats);
rpc GetContrat(ContratId) returns (Contrat);
rpc DeleteContrat(ContratId) returns (Empty) {};
rpc EditContrat(Contrat) returns (Contrat) {};
}
message Empty {}
message ContratId {
int32 id=1;
}
message Contrat {
int32 id=1;
string numeroClient=2;
int32 ddc=3;
int32 ddm=4;
}
message Contrats {
repeated Contrat Contrats=1;
}
on root project
$protoc --version
libprotoc 3.21.12
$protoc protos/*.proto --dart_out=grpc:lib/generated
contrat.pbgrpc.dart
`//
// Generated code. Do not modify.
// source: protos/contrat.proto
//
// @Dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'contrat.pb.dart' as $0;
export 'contrat.pb.dart';
@$pb.GrpcServiceName('trvmyserver.ContratMethods')
class ContratMethodsClient extends $grpc.Client {
static final _$createContrat = $grpc.ClientMethod<$0.Contrat, $0.Contrat>(
'/trvmyserver.ContratMethods/CreateContrat',
($0.Contrat value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Contrat.fromBuffer(value));
static final _$getAllContrats = $grpc.ClientMethod<$0.Empty, $0.Contrats>(
'/trvmyserver.ContratMethods/GetAllContrats',
($0.Empty value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Contrats.fromBuffer(value));
static final _$getContrat = $grpc.ClientMethod<$0.ContratId, $0.Contrat>(
'/trvmyserver.ContratMethods/GetContrat',
($0.ContratId value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Contrat.fromBuffer(value));
static final _$deleteContrat = $grpc.ClientMethod<$0.ContratId, $0.Empty>(
'/trvmyserver.ContratMethods/DeleteContrat',
($0.ContratId value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Empty.fromBuffer(value));
static final _$editContrat = $grpc.ClientMethod<$0.Contrat, $0.Contrat>(
'/trvmyserver.ContratMethods/EditContrat',
($0.Contrat value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Contrat.fromBuffer(value));
ContratMethodsClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options,
interceptors: interceptors);
$grpc.ResponseFuture<$0.Contrat> createContrat($0.Contrat request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$createContrat, request, options: options);
}
$grpc.ResponseFuture<$0.Contrats> getAllContrats($0.Empty request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$getAllContrats, request, options: options);
}
$grpc.ResponseFuture<$0.Contrat> getContrat($0.ContratId request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$getContrat, request, options: options);
}
$grpc.ResponseFuture<$0.Empty> deleteContrat($0.ContratId request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$deleteContrat, request, options: options);
}
$grpc.ResponseFuture<$0.Contrat> editContrat($0.Contrat request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$editContrat, request, options: options);
}
}
@$pb.GrpcServiceName('trvmyserver.ContratMethods')
abstract class ContratMethodsServiceBase extends $grpc.Service {
$core.String get $name => 'trvmyserver.ContratMethods';
ContratMethodsServiceBase() {
$addMethod($grpc.ServiceMethod<$0.Contrat, $0.Contrat>(
'CreateContrat',
createContrat_Pre,
false,
false,
($core.List<$core.int> value) => $0.Contrat.fromBuffer(value),
($0.Contrat value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.Empty, $0.Contrats>(
'GetAllContrats',
getAllContrats_Pre,
false,
false,
($core.List<$core.int> value) => $0.Empty.fromBuffer(value),
($0.Contrats value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ContratId, $0.Contrat>(
'GetContrat',
getContrat_Pre,
false,
false,
($core.List<$core.int> value) => $0.ContratId.fromBuffer(value),
($0.Contrat value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ContratId, $0.Empty>(
'DeleteContrat',
deleteContrat_Pre,
false,
false,
($core.List<$core.int> value) => $0.ContratId.fromBuffer(value),
($0.Empty value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.Contrat, $0.Contrat>(
'EditContrat',
editContrat_Pre,
false,
false,
($core.List<$core.int> value) => $0.Contrat.fromBuffer(value),
($0.Contrat value) => value.writeToBuffer()));
}
$async.Future<$0.Contrat> createContrat_Pre($grpc.ServiceCall call, $async.Future<$0.Contrat> request) async {
return createContrat(call, await request);
}
$async.Future<$0.Contrats> getAllContrats_Pre($grpc.ServiceCall call, $async.Future<$0.Empty> request) async {
return getAllContrats(call, await request);
}
$async.Future<$0.Contrat> getContrat_Pre($grpc.ServiceCall call, $async.Future<$0.ContratId> request) async {
return getContrat(call, await request);
}
$async.Future<$0.Empty> deleteContrat_Pre($grpc.ServiceCall call, $async.Future<$0.ContratId> request) async {
return deleteContrat(call, await request);
}
$async.Future<$0.Contrat> editContrat_Pre($grpc.ServiceCall call, $async.Future<$0.Contrat> request) async {
return editContrat(call, await request);
}
$async.Future<$0.Contrat> createContrat($grpc.ServiceCall call, $0.Contrat request);
$async.Future<$0.Contrats> getAllContrats($grpc.ServiceCall call, $0.Empty request);
$async.Future<$0.Contrat> getContrat($grpc.ServiceCall call, $0.ContratId request);
$async.Future<$0.Empty> deleteContrat($grpc.ServiceCall call, $0.ContratId request);
$async.Future<$0.Contrat> editContrat($grpc.ServiceCall call, $0.Contrat request);
}`
--
In this last file named contrat.pbgrpc.dart, the annotation
@$pb.GrpcServiceName is not recognized
As $pb is a reference on protobuf.dart, it seems to create this ticket on protobuf github rather than grpc github
Best regards,
Stéphane
The text was updated successfully, but these errors were encountered: