Skip to content

Commit fd2c60e

Browse files
authored
Remove runWithClient Flutter example (#1263)
1 parent fece5b3 commit fd2c60e

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

pkgs/cupertino_http/lib/cupertino_http.dart

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,22 @@
4444
///
4545
/// ```
4646
/// void main() {
47-
/// var clientFactory = Client.new; // The default Client.
47+
/// final Client httpClient;
4848
/// if (Platform.isIOS || Platform.isMacOS) {
49-
/// clientFactory = CupertinoClient.defaultSessionConfiguration.call;
49+
/// final config = URLSessionConfiguration.ephemeralSessionConfiguration()
50+
/// ..cache = URLCache.withCapacity(memoryCapacity: 2 * 1024 * 1024)
51+
/// ..httpAdditionalHeaders = {'User-Agent': 'Book Agent'};
52+
/// httpClient = CupertinoClient.fromSessionConfiguration(config);
53+
/// } else {
54+
/// httpClient = IOClient(HttpClient()..userAgent = 'Book Agent');
5055
/// }
51-
/// runWithClient(() => runApp(const MyFlutterApp()), clientFactory);
52-
/// }
53-
/// ```
5456
///
55-
/// After the above setup, calling [Client] methods or any of the
56-
/// `package:http` convenient functions (e.g. [get]) will result in
57-
/// [CupertinoClient] being used on macOS and iOS.
57+
/// runApp(Provider<Client>(
58+
/// create: (_) => httpClient,
59+
/// child: const BookSearchApp(),
60+
/// dispose: (_, client) => client.close()));
61+
/// }
62+
/// ```
5863
///
5964
/// # NSURLSession API
6065
///

pkgs/cupertino_http/lib/src/cupertino_client.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// A [Client] implementation based on the
6-
/// [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system).
7-
library;
8-
95
import 'dart:async';
106
import 'dart:io';
117
import 'dart:typed_data';

0 commit comments

Comments
 (0)