File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 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///
Original file line number Diff line number Diff line change 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-
95import 'dart:async' ;
106import 'dart:io' ;
117import 'dart:typed_data' ;
You can’t perform that action at this time.
0 commit comments