Skip to content

Commit

Permalink
Dart 2 fixes. (flutter#97)
Browse files Browse the repository at this point in the history
Bumped version number since the change to RpcClient.invoke is a breaking change.
  • Loading branch information
jakobr-google authored May 17, 2018
1 parent eb9c5b2 commit 31e583d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.8.0

* Breaking change: Added generics to RpcClient.invoke(). Proto files must be
rebuilt using Dart protoc_plugin version 0.8.0 or newer to match.
* Dart 2 fixes.

## 0.7.2+1

- Updated SDK version to 2.0.0-dev.17.0
Expand Down
2 changes: 1 addition & 1 deletion lib/src/protobuf/field_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class _FieldSet {

List<T> _getDefaultList<T>(FieldInfo<T> fi) {
assert(fi.isRepeated);
if (_isReadOnly) return const [];
if (_isReadOnly) return new List.unmodifiable(const []);

// TODO(skybrian) we could avoid this by generating another
// method for repeated fields:
Expand Down
4 changes: 2 additions & 2 deletions lib/src/protobuf/rpc_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ abstract class RpcClient {
/// The implementation should serialize the request as binary or JSON, as
/// appropriate. It should merge the reply into [emptyResponse] and
/// return it.
Future<GeneratedMessage> invoke(
Future<T> invoke<T extends GeneratedMessage>(
ClientContext ctx,
String serviceName,
String methodName,
GeneratedMessage request,
GeneratedMessage emptyResponse);
T emptyResponse);
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: protobuf
version: 0.7.2+1
version: 0.8.0
author: Dart Team <misc@dartlang.org>
description: Runtime library for protocol buffers support.
homepage: https://github.com/dart-lang/protobuf
Expand Down
4 changes: 2 additions & 2 deletions test/mock_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BuilderInfo mockInfo(String className, CreateBuilderFunc create) {
..a(1, "val", PbFieldType.O3, 42)
..a(2, "str", PbFieldType.OS)
..a(3, "child", PbFieldType.OM, create, create)
..p(4, "int32s", PbFieldType.P3)
..p<int>(4, "int32s", PbFieldType.P3)
..a(5, "int64", PbFieldType.O6);
}

Expand All @@ -31,7 +31,7 @@ abstract class MockMessage extends GeneratedMessage {
MockMessage get child => $_getN(2);
set child(x) => setField(3, x);

List<int> get int32s => $_getN(3);
List<int> get int32s => $_getList(3);

Int64 get int64 => $_get(4, new Int64(0));
set int64(x) => setField(5, x);
Expand Down

0 comments on commit 31e583d

Please sign in to comment.