Skip to content

Commit

Permalink
Undeprecated BigInteger support, but document what it actually does. (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
Hixie authored Dec 15, 2018
1 parent 1778924 commit 8a7ae95
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* <li>null</li>
* <li>Booleans</li>
* <li>Bytes, Shorts, Integers, Longs</li>
* <li>BigIntegers (see below)</li>
* <li>Floats, Doubles</li>
* <li>Strings</li>
* <li>byte[], int[], long[], double[]</li>
Expand All @@ -53,11 +54,8 @@
* <li>Map: Map</li>
* </ul>
*
* <p>Direct support for BigIntegers has been deprecated on 2018-01-09 to be made
* unavailable four weeks after this change is available on the Flutter alpha
* branch. BigIntegers were needed because the Dart 1.0 int type had no size
* limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed integer.
* If you need to communicate larger integers, use String encoding instead.</p>
* <p>BigIntegers are represented in Dart as strings with the
* hexadecimal representation of the integer's value.</p>
*
* <p>To extend the codec, overwrite the writeValue and readValueOfType methods.</p>
*/
Expand Down Expand Up @@ -96,7 +94,6 @@ public Object decodeMessage(ByteBuffer message) {
private static final byte FALSE = 2;
private static final byte INT = 3;
private static final byte LONG = 4;
@Deprecated
private static final byte BIGINT = 5;
private static final byte DOUBLE = 6;
private static final byte STRING = 7;
Expand Down Expand Up @@ -237,7 +234,6 @@ protected void writeValue(ByteArrayOutputStream stream, Object value) {
writeAlignment(stream, 8);
writeDouble(stream, ((Number) value).doubleValue());
} else if (value instanceof BigInteger) {
Log.w("Flutter", "Support for BigIntegers has been deprecated. Use String encoding instead.");
stream.write(BIGINT);
writeBytes(stream,
((BigInteger) value).toString(16).getBytes(UTF8));
Expand Down Expand Up @@ -367,7 +363,6 @@ protected Object readValueOfType(byte type, ByteBuffer buffer) {
result = buffer.getLong();
break;
case BIGINT: {
Log.w("Flutter", "Support for BigIntegers has been deprecated. Use String encoding instead.");
final byte[] hex = readBytes(buffer);
result = new BigInteger(new String(hex, UTF8), 16);
break;
Expand Down

0 comments on commit 8a7ae95

Please sign in to comment.