Skip to content

Commit

Permalink
Update source of excerpt for use of package:http
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough committed Dec 11, 2023
1 parent 171c967 commit 22437f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/misc/lib/library_tour/async/basic.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import 'dart:html';
import 'package:http/http.dart';

void miscDeclAnalyzedButNotTested() {
const url = 'humans.txt';
final url = Uri.parse('humans.txt');
final httpClient = Client();

{
// #docregion then
HttpRequest.getString(url).then((String result) {
httpClient.read(url).then((String result) {
print(result);
});
// #enddocregion then
}

{
// #docregion catchError
HttpRequest.getString(url).then((String result) {
httpClient.read(url).then((String result) {
print(result);
}).catchError((e) {
// Handle or ignore the error.
Expand Down
1 change: 1 addition & 0 deletions examples/misc/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
args: ^2.4.2
characters: ^1.3.0
examples_util: { path: ../util }
http: ^1.1.2

dev_dependencies:
lints: ^3.0.0
Expand Down

0 comments on commit 22437f2

Please sign in to comment.