comments and formatting
diff --git a/examples/Makefile b/examples/Makefile
index 41c9849..39254bb 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -36,6 +36,7 @@
protoc_middleman_dart: addressbook.proto
mkdir -p dart_tutorial # make directory for the dart package
protoc $$PROTO_PATH --dart_out=dart_tutorial addressbook.proto
+ protoc -I../src/ --dart_out=dart_tutorial ../src/google/protobuf/timestamp.proto
pub get
@touch protoc_middleman_dart
diff --git a/examples/README.md b/examples/README.md
index 37372ce..843fdd6 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -119,7 +119,7 @@
./list_people_go addressbook.data
-Observe that the C++, Python, and Java examples in this directory run in a
+Observe that the C++, Python, Java, and Dart examples in this directory run in a
similar way and can view/modify files created by the Go example and vice
versa.
@@ -134,9 +134,10 @@
To run the examples:
+```sh
$ dart add_person.dart addessbook.data
$ dart list_people.dart addressbook.data
-
+```
The two programs take a protocol buffer encoded file as their parameter.
The first can be used to add a person to the file. The file is created
diff --git a/examples/add_person.dart b/examples/add_person.dart
index 7aaa079..a93ec60 100644
--- a/examples/add_person.dart
+++ b/examples/add_person.dart
@@ -4,7 +4,6 @@
// This function fills in a Person message based on user input.
Person promtForAddress() {
-
Person person = Person();
print('Enter person ID: ');
@@ -20,9 +19,9 @@
person.email = email;
}
- while(true) {
+ while (true) {
print('Enter a phone number (or leave blank to finish): ');
- String number = stdin. readLineSync();
+ String number = stdin.readLineSync();
if (number.isEmpty) break;
Person_PhoneNumber phoneNumber = Person_PhoneNumber();
@@ -31,7 +30,7 @@
print('Is this a mobile, home, or work phone? ');
String type = stdin.readLineSync();
- switch(type) {
+ switch (type) {
case 'mobile':
phoneNumber.type = Person_PhoneType.MOBILE;
break;
@@ -62,10 +61,10 @@
AddressBook addressBook;
if (!file.existsSync()) {
print('File not found. Creating new file.');
- addressBook = AddressBook();
+ addressBook = AddressBook();
} else {
addressBook = AddressBook.fromBuffer(file.readAsBytesSync());
}
addressBook.people.add(promtForAddress());
file.writeAsBytes(addressBook.writeToBuffer());
-}
\ No newline at end of file
+}