mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Prepare for Uint8List SDK breaking changes (#34295)
https://github.com/dart-lang/sdk/issues/36900
This commit is contained in:
parent
bdd07240cd
commit
fb2f18e7e8
@ -65,7 +65,7 @@ class Upload {
|
|||||||
} else {
|
} else {
|
||||||
// TODO(hansmuller): only retry on 5xx and 429 responses
|
// TODO(hansmuller): only retry on 5xx and 429 responses
|
||||||
logMessage('Request to save "$name" (length ${content.length}) failed with status ${response.statusCode}, will retry');
|
logMessage('Request to save "$name" (length ${content.length}) failed with status ${response.statusCode}, will retry');
|
||||||
logMessage(await response.transform<String>(utf8.decoder).join());
|
logMessage(await response.cast<List<int>>().transform<String>(utf8.decoder).join());
|
||||||
}
|
}
|
||||||
return response.statusCode == HttpStatus.ok;
|
return response.statusCode == HttpStatus.ok;
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
|
@ -299,7 +299,7 @@ Future<void> precacheLanguageAndRegionTags() async {
|
|||||||
final HttpClient client = HttpClient();
|
final HttpClient client = HttpClient();
|
||||||
final HttpClientRequest request = await client.getUrl(Uri.parse(registry));
|
final HttpClientRequest request = await client.getUrl(Uri.parse(registry));
|
||||||
final HttpClientResponse response = await request.close();
|
final HttpClientResponse response = await request.close();
|
||||||
final String body = (await response.transform<String>(utf8.decoder).toList()).join('');
|
final String body = (await response.cast<List<int>>().transform<String>(utf8.decoder).toList()).join('');
|
||||||
client.close(force: true);
|
client.close(force: true);
|
||||||
final List<Map<String, List<String>>> sections = body.split('%%').skip(1).map<Map<String, List<String>>>(_parseSection).toList();
|
final List<Map<String, List<String>>> sections = body.split('%%').skip(1).map<Map<String, List<String>>>(_parseSection).toList();
|
||||||
for (Map<String, List<String>> section in sections) {
|
for (Map<String, List<String>> section in sections) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/io.dart' as io;
|
import 'package:flutter_tools/src/base/io.dart' as io;
|
||||||
import 'package:flutter_tools/src/base/net.dart';
|
import 'package:flutter_tools/src/base/net.dart';
|
||||||
@ -216,13 +217,13 @@ class MockHttpClientResponse extends Stream<List<int>> implements io.HttpClientR
|
|||||||
String get reasonPhrase => '<reason phrase>';
|
String get reasonPhrase => '<reason phrase>';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
StreamSubscription<List<int>> listen(
|
StreamSubscription<Uint8List> listen(
|
||||||
void onData(List<int> event), {
|
void onData(Uint8List event), {
|
||||||
Function onError,
|
Function onError,
|
||||||
void onDone(),
|
void onDone(),
|
||||||
bool cancelOnError,
|
bool cancelOnError,
|
||||||
}) {
|
}) {
|
||||||
return Stream<List<int>>.fromFuture(Future<List<int>>.error(const io.SocketException('test')))
|
return Stream<Uint8List>.fromFuture(Future<Uint8List>.error(const io.SocketException('test')))
|
||||||
.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
@ -1303,13 +1304,13 @@ class MockHttpClientResponse extends Stream<List<int>> implements HttpClientResp
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@override
|
@override
|
||||||
StreamSubscription<List<int>> listen(
|
StreamSubscription<Uint8List> listen(
|
||||||
void onData(List<int> event), {
|
void onData(Uint8List event), {
|
||||||
Function onError,
|
Function onError,
|
||||||
void onDone(),
|
void onDone(),
|
||||||
bool cancelOnError,
|
bool cancelOnError,
|
||||||
}) {
|
}) {
|
||||||
return Stream<List<int>>.fromIterable(<List<int>>[result.codeUnits])
|
return Stream<Uint8List>.fromIterable(<Uint8List>[Uint8List.fromList(result.codeUnits)])
|
||||||
.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user