@@ -59,7 +59,7 @@ class ProtocolBufferEncoder {
5959
6060 /// Encode a [Map] with the given [fieldNumber] and [value] .
6161 static List <int > _encodeMap (int fieldNumber, Map value) {
62- List <int > result = [];
62+ final List <int > result = [];
6363 for (final i in value.entries) {
6464 final key = encode (1 , i.key);
6565 final val = encode (2 , i.value);
@@ -73,8 +73,8 @@ class ProtocolBufferEncoder {
7373 /// Encode length of the data for the given [fieldNumber] and [value] .
7474 static List <int > _encodeLength (int fieldNumber, int value) {
7575 _validateInt (value);
76- List <int > result = [];
77- int tag = (fieldNumber << 3 ) | 2 ;
76+ final List <int > result = [];
77+ final int tag = (fieldNumber << 3 ) | 2 ;
7878 result.addAll (_encodeVarint32 (tag));
7979 result.addAll (_encodeVarint32 (value));
8080
@@ -84,7 +84,7 @@ class ProtocolBufferEncoder {
8484 /// Encode a list with the given [fieldNumber] and [value] .
8585 static List <int > _encodeList (int fieldNumber, List <dynamic > value) {
8686 if (value.isEmpty) return [];
87- List <int > result = [];
87+ final List <int > result = [];
8888 for (final i in value) {
8989 result.addAll (encode (fieldNumber, i));
9090 }
@@ -94,10 +94,10 @@ class ProtocolBufferEncoder {
9494 /// Encode a [BigInt] with the given [fieldNumber] and [value] .
9595 static List <int > _encodeBigInt (int fieldNumber, BigInt value) {
9696 _validateBigInt (value);
97- List <int > result = [];
97+ final List <int > result = [];
9898
9999 // Combine field number and wire type (0 for varint)
100- int tag = (fieldNumber << 3 ) | 0 ;
100+ final int tag = (fieldNumber << 3 ) | 0 ;
101101 BigInt mybeZigZag = value;
102102 if (value.isNegative) {
103103 mybeZigZag = ((value & _maxInt64) | _minInt64);
@@ -111,7 +111,7 @@ class ProtocolBufferEncoder {
111111
112112 /// Utility function to encode a 64-bit varint.
113113 static List <int > _encodeVarintBigInt (BigInt value) {
114- List <int > result = [];
114+ final List <int > result = [];
115115 while (value > BigInt .from (0x7F )) {
116116 result.add ((value & BigInt .from (0x7F ) | BigInt .from (0x80 )).toInt ());
117117 value >> = 7 ;
@@ -122,7 +122,7 @@ class ProtocolBufferEncoder {
122122
123123 /// Encode a 32-bit varint with the given [value] .
124124 static List <int > _encodeVarint32 (int value) {
125- List <int > result = [];
125+ final List <int > result = [];
126126 while (value > 0x7F ) {
127127 result.add ((value & 0x7F ) | 0x80 );
128128 value >> = 7 ;
@@ -134,8 +134,8 @@ class ProtocolBufferEncoder {
134134 /// Encode an [int] with the given [fieldNumber]
135135 static List <int > _encodeInt (int fieldNumber, int value) {
136136 _validateInt (value);
137- List <int > result = [];
138- int tag = (fieldNumber << 3 ) | 0 ;
137+ final List <int > result = [];
138+ final int tag = (fieldNumber << 3 ) | 0 ;
139139 result.addAll (_encodeVarint32 (tag));
140140 if (value.isNegative) {
141141 final BigInt zigzag = ((BigInt .from (value) & _maxInt64) | _minInt64);
@@ -149,7 +149,7 @@ class ProtocolBufferEncoder {
149149
150150 /// Encode a byte array with the given [fieldNumber] and [value] .
151151 static List <int > _encodeBytes (int fieldNumber, List <int > value) {
152- List <int > result = [];
152+ final List <int > result = [];
153153 result.addAll (_encodeLength (fieldNumber, value.length));
154154 result.addAll (value);
155155
0 commit comments