Commit bc00484b authored by Sarah Zakarias's avatar Sarah Zakarias

comments and formatting

parent 969397b7
...@@ -36,6 +36,7 @@ protoc_middleman_go: addressbook.proto ...@@ -36,6 +36,7 @@ protoc_middleman_go: addressbook.proto
protoc_middleman_dart: addressbook.proto protoc_middleman_dart: addressbook.proto
mkdir -p dart_tutorial # make directory for the dart package mkdir -p dart_tutorial # make directory for the dart package
protoc $$PROTO_PATH --dart_out=dart_tutorial addressbook.proto protoc $$PROTO_PATH --dart_out=dart_tutorial addressbook.proto
protoc -I../src/ --dart_out=dart_tutorial ../src/google/protobuf/timestamp.proto
pub get pub get
@touch protoc_middleman_dart @touch protoc_middleman_dart
......
...@@ -119,7 +119,7 @@ is created if it does not exist. To view the data, run: ...@@ -119,7 +119,7 @@ is created if it does not exist. To view the data, run:
./list_people_go addressbook.data ./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 similar way and can view/modify files created by the Go example and vice
versa. versa.
...@@ -134,9 +134,10 @@ Build the Dart samples in this directory with `make dart`. ...@@ -134,9 +134,10 @@ Build the Dart samples in this directory with `make dart`.
To run the examples: To run the examples:
```sh
$ dart add_person.dart addessbook.data $ dart add_person.dart addessbook.data
$ dart list_people.dart addressbook.data $ dart list_people.dart addressbook.data
```
The two programs take a protocol buffer encoded file as their parameter. 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 The first can be used to add a person to the file. The file is created
......
...@@ -4,7 +4,6 @@ import 'dart_tutorial/addressbook.pb.dart'; ...@@ -4,7 +4,6 @@ import 'dart_tutorial/addressbook.pb.dart';
// This function fills in a Person message based on user input. // This function fills in a Person message based on user input.
Person promtForAddress() { Person promtForAddress() {
Person person = Person(); Person person = Person();
print('Enter person ID: '); print('Enter person ID: ');
...@@ -20,9 +19,9 @@ Person promtForAddress() { ...@@ -20,9 +19,9 @@ Person promtForAddress() {
person.email = email; person.email = email;
} }
while(true) { while (true) {
print('Enter a phone number (or leave blank to finish): '); print('Enter a phone number (or leave blank to finish): ');
String number = stdin. readLineSync(); String number = stdin.readLineSync();
if (number.isEmpty) break; if (number.isEmpty) break;
Person_PhoneNumber phoneNumber = Person_PhoneNumber(); Person_PhoneNumber phoneNumber = Person_PhoneNumber();
...@@ -31,7 +30,7 @@ Person promtForAddress() { ...@@ -31,7 +30,7 @@ Person promtForAddress() {
print('Is this a mobile, home, or work phone? '); print('Is this a mobile, home, or work phone? ');
String type = stdin.readLineSync(); String type = stdin.readLineSync();
switch(type) { switch (type) {
case 'mobile': case 'mobile':
phoneNumber.type = Person_PhoneType.MOBILE; phoneNumber.type = Person_PhoneType.MOBILE;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment