Merge pull request #5386 from ThinkDigitalRepair/patch-1

Update add_person.dart
pull/5397/head
Adam Cozzette 6 years ago committed by GitHub
commit 9313cdc442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      examples/add_person.dart

@ -3,7 +3,7 @@ import 'dart:io';
import 'dart_tutorial/addressbook.pb.dart'; 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 promptForAddress() {
Person person = Person(); Person person = Person();
print('Enter person ID: '); print('Enter person ID: ');
@ -65,6 +65,6 @@ main(List<String> arguments) {
} else { } else {
addressBook = AddressBook.fromBuffer(file.readAsBytesSync()); addressBook = AddressBook.fromBuffer(file.readAsBytesSync());
} }
addressBook.people.add(promtForAddress()); addressBook.people.add(promptForAddress());
file.writeAsBytes(addressBook.writeToBuffer()); file.writeAsBytes(addressBook.writeToBuffer());
} }

Loading…
Cancel
Save