NonStop
Digital Product Development Experts for Startups & Enterprises
🎉 Founded by Ajay Kumar 🎉**
contact_permission
A plugin for Flutter that requests and verifies contact permissions.
Why this package?
Integrating Flutter Frameworks into the Android and iOS "add-to-app" scenario can pose its own set of challenges. In one instance, when attempting to integrate the permission_handler, we mistakenly added
GCC_PREPROCESSOR_DEFINITIONSflags to the root project instead of within the module package. After numerous hours of researching the issue, it became evident that this approach was not effective. As a result, we had to relocate the flags to the Flutter Module Podfile, which should not have been committed in the first place. However, even after this adjustment, we discovered that the Android permission was still not functioning correctly on many devices. This predicament led to the development of this package.
Compatibility and migration
Requires Flutter 3.44 or newer and Dart 3.12 or newer (below Dart 4). Android now requires API 24+, compile SDK 36, and Java 17-compatible compilation. The plugin build uses Android Gradle Plugin 9.4.1 and the Gradle 9.7.1 wrapper. iOS deployment targets must be 15.0 or newer. Update the application's Android build configuration and iOS deployment target before upgrading.
The permission-checking Dart API is unchanged. Applications that still need older Android or iOS releases should keep using the 1.x package series.
Getting Started
- Open your project's
pubspec.yamlfile. - Add the
contact_permissionpackage to your dependencies, replacing[version]with the latest version:dependencies: flutter: sdk: flutter contact_permission: ^[version] - Run
flutter pub getto fetch the package.
Import the Package
import 'package:contact_permission/contact_permission.dart';
Check if permission is granted or not
...
onTap: () async {
if (await ContactPermission.isPermissionGranted) {
showSnackBar(
_scaffoldKey,
title: "Contact Permission Granted",
color: Colors.green,
);
} else {
showSnackBar(
_scaffoldKey,
title: "Contact Permission Not Granted",
);
}
},
...
Request permission
...
onTap: () async {
if (await ContactPermission.requestPermission) {
showSnackBar(
_scaffoldKey,
title: "Contact Permission Granted",
color: Colors.green,
);
} else {
showSnackBar(
_scaffoldKey,
title: "Contact Permission Not Granted",
);
}
},
Contributing
We welcome contributions in various forms:
- Proposing new features or enhancements.
- Reporting and fixing bugs.
- Engaging in discussions to help make decisions.
- Improving documentation, as it is essential.
- Sending Pull Requests is greatly appreciated!
A big thank you to all our contributors! 🙌
🔗 Connect with NonStop
⭐ Star us on GitHub if this helped you!
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.