Skip to content

Commit

Permalink
Remove runWithClient Flutter example
Browse files Browse the repository at this point in the history
  • Loading branch information
brianquinlan committed Jul 11, 2024
1 parent 068308b commit 37d536d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
21 changes: 13 additions & 8 deletions pkgs/cupertino_http/lib/cupertino_http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,22 @@
///
/// ```
/// void main() {
/// var clientFactory = Client.new; // The default Client.
/// final Client httpClient;
/// if (Platform.isIOS || Platform.isMacOS) {
/// clientFactory = CupertinoClient.defaultSessionConfiguration.call;
/// final config = URLSessionConfiguration.ephemeralSessionConfiguration()
/// ..cache = URLCache.withCapacity(memoryCapacity: 2 * 1024 * 1024)
/// ..httpAdditionalHeaders = {'User-Agent': 'Book Agent'};
/// httpClient = CupertinoClient.fromSessionConfiguration(config);
/// } else {
/// httpClient = IOClient(HttpClient()..userAgent = 'Book Agent');
/// }
/// runWithClient(() => runApp(const MyFlutterApp()), clientFactory);
/// }
/// ```
///
/// After the above setup, calling [Client] methods or any of the
/// `package:http` convenient functions (e.g. [get]) will result in
/// [CupertinoClient] being used on macOS and iOS.
/// runApp(Provider<Client>(
/// create: (_) => httpClient,
/// child: const BookSearchApp(),
/// dispose: (_, client) => client.close()));
/// }
/// ```
///
/// # NSURLSession API
///
Expand Down
4 changes: 0 additions & 4 deletions pkgs/cupertino_http/lib/src/cupertino_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// A [Client] implementation based on the
/// [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system).
library;

import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
Expand Down

0 comments on commit 37d536d

Please sign in to comment.