getJsonConstant method

String getJsonConstant(
  1. FileGenerator context
)

Returns a const expression that evaluates to the JSON for this message.

context represents the .pb.dart file where the expression will be used.

Implementation

String getJsonConstant(FileGenerator context) {
  final name = '$classname\$json';
  if (context.protoFileUri == fileGen.protoFileUri) {
    return name;
  }
  return '${importPrefix(context: context)}.$name';
}