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

Unified Diff: samples/chat/dart_client/chat.dart

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
Index: samples/chat/dart_client/chat.dart
diff --git a/samples/chat/dart_client/chat.dart b/samples/chat/dart_client/chat.dart
index 4913fb6859ef593411a333ef9f843b576be6905e..c4c2eaa8a5cfbb186f8718ae98354c9e6c3a67f5 100644
--- a/samples/chat/dart_client/chat.dart
+++ b/samples/chat/dart_client/chat.dart
@@ -217,13 +217,13 @@ class Chat {
String from = message["from"];
StringBuffer text = new StringBuffer("$formattedTime $from ");
if (message["type"] == "join") {
- text.add("joined");
+ text.write("joined");
} else if (message["type"] == "message") {
- text.add(message["message"]);
+ text.write(message["message"]);
} else if (message["type"] == "leave") {
- text.add("left");
+ text.write("left");
} else {
- text.add("timeout");
+ text.write("timeout");
}
p.text = text.toString();
_messages.insertAdjacentElement('afterBegin', p);
@@ -235,14 +235,14 @@ class Chat {
String formatMessageTime(String received) {
DateTime date = DateTime.parse(received);
StringBuffer formattedTime = new StringBuffer();
- if (date.hour < 10) formattedTime.add("0");
- formattedTime.add(date.hour);
- formattedTime.add(":");
- if (date.minute < 10) formattedTime.add("0");
- formattedTime.add(date.minute);
- formattedTime.add(":");
- if (date.second < 10) formattedTime.add("0");
- formattedTime.add(date.second);
+ if (date.hour < 10) formattedTime.write("0");
+ formattedTime.write(date.hour);
+ formattedTime.write(":");
+ if (date.minute < 10) formattedTime.write("0");
+ formattedTime.write(date.minute);
+ formattedTime.write(":");
+ if (date.second < 10) formattedTime.write("0");
+ formattedTime.write(date.second);
return formattedTime.toString();
}
@@ -254,14 +254,14 @@ class Chat {
upTime = upTime % 60;
int seconds = upTime;
StringBuffer formattedTime = new StringBuffer();
- if (hours < 10) formattedTime.add("0");
- formattedTime.add(hours);
- formattedTime.add(":");
- if (minutes < 10) formattedTime.add("0");
- formattedTime.add(minutes);
- formattedTime.add(":");
- if (seconds < 10) formattedTime.add("0");
- formattedTime.add(seconds);
+ if (hours < 10) formattedTime.write("0");
+ formattedTime.write(hours);
+ formattedTime.write(":");
+ if (minutes < 10) formattedTime.write("0");
+ formattedTime.write(minutes);
+ formattedTime.write(":");
+ if (seconds < 10) formattedTime.write("0");
+ formattedTime.write(seconds);
return formattedTime.toString();
}

Powered by Google App Engine
This is Rietveld 408576698