Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cupertino_http: remove runWithClient Flutter example #1263

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading