Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: packages/barback/lib/src/asset/internal_asset.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/barback/lib/src/asset/asset_set.dart ('k') | packages/barback/lib/src/build_result.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/barback/lib/src/asset/internal_asset.dart
diff --git a/packages/barback/lib/src/asset/internal_asset.dart b/packages/barback/lib/src/asset/internal_asset.dart
index dfacba5c80e1f90c24ad564288001cf20077f1a2..ed7f3093155e1673bdda7cc104742afb98bbcd01 100644
--- a/packages/barback/lib/src/asset/internal_asset.dart
+++ b/packages/barback/lib/src/asset/internal_asset.dart
@@ -8,6 +8,9 @@ import 'dart:async';
import 'dart:convert';
import 'dart:typed_data';
+import 'package:async/async.dart';
+import 'package:collection/collection.dart';
+
import '../serialize.dart';
import '../utils.dart';
import '../utils/file_pool.dart';
@@ -52,11 +55,14 @@ Map serializeAsset(Asset asset) {
Asset deserializeAsset(Map asset) {
var id = deserializeId(asset['id']);
switch (asset['type']) {
- case 'binary': return new BinaryAsset(id, asset['contents']);
+ case 'binary':
+ return new BinaryAsset(
+ id, DelegatingList.typed(asset['contents'] as List));
case 'file': return new FileAsset(id, asset['path']);
case 'string': return new StringAsset(id, asset['contents']);
case 'stream':
- return new StreamAsset(id, deserializeStream(asset['stream']));
+ return new StreamAsset(
+ id, DelegatingStream.typed(deserializeStream(asset['stream'])));
default:
throw new FormatException('Unknown asset type "${asset['type']}".');
}
@@ -177,8 +183,8 @@ class StreamAsset implements Asset {
Future<String> readAsString({Encoding encoding}) {
if (encoding == null) encoding = UTF8;
- return _replayer.getReplay().toList()
- .then((chunks) => encoding.decode(flatten(chunks)));
+ return _replayer.getReplay().expand((chunk) => chunk).toList()
+ .then((bytes) => encoding.decode(bytes));
}
Stream<List<int>> read() => _replayer.getReplay();
« no previous file with comments | « packages/barback/lib/src/asset/asset_set.dart ('k') | packages/barback/lib/src/build_result.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698