Skip to main content

cupertino_hooks 0.1.0 copy "cupertino_hooks: ^0.1.0" to clipboard
cupertino_hooks: ^0.1.0 copied to clipboard

Flutter hooks for the Cupertino library (package:cupertino_ui).

cupertino_hooks #

flutter_hooks for cupertino_ui.

Since Flutter 3.47, package:flutter/cupertino.dart is deprecated in favor of package:cupertino_ui. This package provides hooks for the controllers of package:cupertino_ui:

Name Description
useCupertinoTabController Creates and disposes a CupertinoTabController.

Usage #

Import cupertino_hooks alongside flutter_hooks:

import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:cupertino_hooks/cupertino_hooks.dart';
import 'package:cupertino_ui/cupertino_ui.dart';

While flutter_hooks still contains the deprecated versions of these hooks, using one of them in a file that imports both packages is ambiguous. Hide the deprecated version from flutter_hooks:

import 'package:flutter_hooks/flutter_hooks.dart' hide useCupertinoTabController;

Migrating from flutter_hooks #

The hooks listed above used to be part of flutter_hooks and returned controllers from package:flutter/cupertino.dart. Those versions are deprecated.

To migrate:

  1. Add cupertino_hooks and cupertino_ui to your dependencies.
  2. Replace package:flutter/cupertino.dart imports with package:cupertino_ui/cupertino_ui.dart.
  3. Import package:cupertino_hooks/cupertino_hooks.dart in files using these hooks, and hide them from the flutter_hooks import as shown above.
0
likes
150
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter hooks for the Cupertino library (package:cupertino_ui).

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

cupertino_ui, flutter, flutter_hooks

More

Packages that depend on cupertino_hooks