I run these commands:
brew install protobuf
flutter pub global activate protoc_plugin
export PATH="$PATH:/Users/gintas/flutter/.pub-cache/bin"
protoc --dart_out=. ./lib/models/protobuf/models.proto -I=.
I get this garbage:
--dart_out: protoc-gen-dart: Plugin output is unparseable: \rz\354\014\n\"lib/models/protobuf/models.pb.dartz\305\014///\n// Generated code. Do not modify.\n// source: lib/models/protobuf/models.proto\n//\n// @dart = 2.3\n// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type\n\nimport \'dart:core\' as $core;\n\nimport \'package:protobuf/protobuf.dart\' as $pb;\n\nclass MessageEnvelope extends $pb.GeneratedMessage {\n static final $pb.BuilderInfo i = $pb.BuilderInfo(\'MessageEnvelope\', package: const $pb.PackageName(\'proto\'), createEmptyInstance: create)\n ..hasRequiredFields = false\n ;\n\n MessageEnvelope.() : super();\n factory MessageEnvelope() => create();\n factory MessageEnvelope.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);\n factory MessageEnvelope.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);\n MessageEnvelope clone() => MessageEnvelope()..mergeFromMessage(this);\n MessageEnvelope copyWith(void Function(MessageEnvelope) updates) => super.copyWith((message) => updates(message as MessageEnvelope));\n $pb.BuilderInfo get info_ => i;\n @$core.pragma(\'dart2js:noInline\')\n static MessageEnvelope create() => MessageEnvelope.();\n MessageEnvelope createEmptyInstance() => create();\n static $pb.PbList createRepeated() => $pb.PbList();\n @$core.pragma(\'dart2js:noInline\')\n static MessageEnvelope getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create);\n static MessageEnvelope _defaultInstance;\n}\n\nz\235\002\n&lib/models/protobuf/models.pbenum.dartz\362\001///\n// Generated code. Do not modify.\n// source: lib/models/protobuf/models.proto\n//\n// @dart = 2.3\n// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type\n\nz\340\002\n&lib/models/protobuf/models.pbjson.dartz\265\002///\n// Generated code. Do not modify.\n// source: lib/models/protobuf/models.proto\n//\n// @dart = 2.3\n// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type\n\nconst MessageEnvelope$json = const {\n \'1\': \'MessageEnvelope\',\n};\n\nz\271\002\n(lib/models/protobuf/models.pbserver.dartz\214\002///\n// Generated code. Do not modify.\n// source: lib/models/protobuf/models.proto\n//\n// @dart = 2.3\n// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type\n\nexport \'models.pb.dart\';\n\n
flutter doctor -v
[✓] Flutter (Channel master, 1.19.0-2.0.pre.173, on Mac OS X 10.15.4 19E287, locale en-GB)
• Flutter version 1.19.0-2.0.pre.173 at /Users/gintas/flutter
• Framework revision 5663e02645 (23 hours ago), 2020-05-27 18:32:01 -0400
• Engine revision 2663be8370
• Dart version 2.9.0 (build 2.9.0-11.0.dev e007545c42)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/gintas/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.9.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[!] VS Code (version 1.43.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• macOS • macOS • darwin-x64 • Mac OS X 10.15.4 19E287
• Web Server • web-server • web-javascript • Flutter Tools
• Chrome • chrome • web-javascript • Google Chrome 83.0.4103.61
! Doctor found issues in 1 category.
If I do protoc --java_out=. ./lib/models/protobuf/models.proto -I=., then Java file is generated ok without error
I cannot reproduce this issue. Please make sure you have the latest protoc_plugin installed. Feel free to re-open it the problem persists with the latest protoc_plugin.
models.proto:
I run these commands: brew install protobuf flutter pub global activate protoc_plugin export PATH="$PATH:/Users/gintas/flutter/.pub-cache/bin" protoc --dart_out=. ./lib/models/protobuf/models.proto -I=.
I get this garbage:
If I do
protoc --java_out=. ./lib/models/protobuf/models.proto -I=.
, then Java file is generated ok without error