Top Related Projects
Flutter Launcher Icons - A package which simplifies the task of updating your Flutter app's launcher icon. Fully flexible, allowing you to choose what platform you wish to update the launcher icon for and if you want, the option to keep your old launcher icon in case you want to revert back sometime in the future. Maintainer: @MarkOSullivan94
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
SQLite flutter plugin
Quick Overview
Flutter/plugins is an official repository maintained by the Flutter team, containing a collection of plugins that enable Flutter apps to interact with various platform-specific features and services. These plugins bridge the gap between Flutter's cross-platform framework and native functionalities on iOS and Android.
Pros
- Wide range of plugins covering essential functionalities like camera, in-app purchases, and geolocation
- Official support and maintenance from the Flutter team
- Consistent API design across plugins for easier integration
- Regular updates and improvements to keep pace with Flutter's development
Cons
- Some plugins may have limited functionality compared to native implementations
- Occasional delays in updating plugins for new platform versions or features
- Dependency on third-party contributions for certain plugins
- Potential performance overhead due to platform channel communication
Code Examples
- Using the
camera
plugin to take a picture:
import 'package:camera/camera.dart';
Future<void> takePicture() async {
final cameras = await availableCameras();
final firstCamera = cameras.first;
final controller = CameraController(firstCamera, ResolutionPreset.medium);
await controller.initialize();
final image = await controller.takePicture();
print('Picture saved to: ${image.path}');
}
- Implementing in-app purchases with the
in_app_purchase
plugin:
import 'package:in_app_purchase/in_app_purchase.dart';
Future<void> buyProduct(String productId) async {
final bool available = await InAppPurchase.instance.isAvailable();
if (!available) {
print('Store not available');
return;
}
final ProductDetailsResponse response = await InAppPurchase.instance.queryProductDetails({productId});
if (response.productDetails.isEmpty) {
print('Product not found');
return;
}
final PurchaseParam purchaseParam = PurchaseParam(productDetails: response.productDetails.first);
await InAppPurchase.instance.buyNonConsumable(purchaseParam: purchaseParam);
}
- Getting the current location using the
geolocator
plugin:
import 'package:geolocator/geolocator.dart';
Future<void> getCurrentLocation() async {
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
print('Location services are disabled');
return;
}
LocationPermission permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
print('Location permissions are denied');
return;
}
}
Position position = await Geolocator.getCurrentPosition();
print('Current location: ${position.latitude}, ${position.longitude}');
}
Getting Started
To use a plugin from flutter/plugins in your Flutter project:
-
Add the plugin to your
pubspec.yaml
file:dependencies: camera: ^0.10.0
-
Run
flutter pub get
to fetch the plugin. -
Import the plugin in your Dart code:
import 'package:camera/camera.dart';
-
Use the plugin's API in your app as shown in the code examples above.
-
For platform-specific setup, refer to the plugin's README file for additional configuration steps (e.g., adding permissions to AndroidManifest.xml or Info.plist).
Competitor Comparisons
Flutter Launcher Icons - A package which simplifies the task of updating your Flutter app's launcher icon. Fully flexible, allowing you to choose what platform you wish to update the launcher icon for and if you want, the option to keep your old launcher icon in case you want to revert back sometime in the future. Maintainer: @MarkOSullivan94
Pros of flutter_launcher_icons
- Focused specifically on generating launcher icons, providing a streamlined solution for this common task
- Offers more customization options for icon generation, including adaptive icons for Android
- Simpler configuration process using a YAML file
Cons of flutter_launcher_icons
- Limited in scope compared to the broader range of plugins offered by flutter/plugins
- May require additional setup steps for integration into existing projects
- Less frequent updates and potentially smaller community support
Code Comparison
flutter_launcher_icons configuration (pubspec.yaml):
flutter_icons:
android: true
ios: true
image_path: "assets/icon/icon.png"
adaptive_icon_background: "#ffffff"
adaptive_icon_foreground: "assets/icon/foreground.png"
flutter/plugins example (camera plugin):
import 'package:camera/camera.dart';
Future<void> initializeCamera() async {
final cameras = await availableCameras();
final firstCamera = cameras.first;
_controller = CameraController(firstCamera, ResolutionPreset.medium);
await _controller.initialize();
}
The flutter_launcher_icons project provides a straightforward solution for generating app icons, while flutter/plugins offers a wider range of functionality across various plugins. The choice between them depends on the specific needs of your project and whether you require a dedicated icon generation tool or a more comprehensive set of plugins for different features.
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
Pros of flutter-permission-handler
- Focused specifically on permission handling, providing a more comprehensive and specialized solution
- Regularly updated with support for the latest platform-specific permission requirements
- Simpler API for requesting and checking permissions across platforms
Cons of flutter-permission-handler
- Limited to permission-related functionality, whereas plugins covers a broader range of features
- May require additional setup steps compared to the more integrated plugins repository
- Potentially less official support or integration with the Flutter framework
Code Comparison
flutter-permission-handler:
import 'package:permission_handler/permission_handler.dart';
Future<void> requestCameraPermission() async {
if (await Permission.camera.request().isGranted) {
// Camera permission granted
}
}
plugins (camera example):
import 'package:camera/camera.dart';
Future<void> initializeCamera() async {
final cameras = await availableCameras();
final firstCamera = cameras.first;
// Use firstCamera to initialize CameraController
}
The flutter-permission-handler code focuses specifically on requesting permissions, while the plugins example demonstrates camera initialization without explicit permission handling.
SQLite flutter plugin
Pros of sqflite
- Focused specifically on SQLite database operations for Flutter
- More lightweight and specialized compared to the broader plugins repository
- Actively maintained with frequent updates and bug fixes
Cons of sqflite
- Limited to SQLite functionality, while plugins covers a wider range of features
- Smaller community and potentially fewer contributors
- May require additional plugins for other database types or functionalities
Code Comparison
sqflite:
final db = await openDatabase('my_db.db');
await db.execute('CREATE TABLE Test (id INTEGER PRIMARY KEY, name TEXT)');
await db.insert('Test', {'name': 'example'});
plugins (using sqflite):
import 'package:sqflite/sqflite.dart';
final db = await openDatabase('my_db.db');
await db.execute('CREATE TABLE Test (id INTEGER PRIMARY KEY, name TEXT)');
await db.insert('Test', {'name': 'example'});
The code usage is similar, as plugins includes sqflite as one of its many packages. The main difference is that sqflite can be imported directly when using the specialized repository, while it needs to be explicitly imported from the plugins package when using the broader repository.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Flutter plugins
ARCHIVED |
---|
This repository is no longer in use; all source has moved to flutter/packages and future development work will be done there. |
ARCHIVED CONTENT
This repo is a companion repo to the main flutter
repo. It contains the source code for
Flutter first-party plugins (i.e., plugins developed by the core Flutter team).
Check the packages
directory for all plugins.
Flutter plugins enable access to platform-specific APIs. For more information about plugins, and how to use them, see https://flutter.dev/platform-plugins/.
These plugins are also available on pub.
Issues
Please file any issues, bugs, or feature requests in the main flutter repo.
Issues pertaining to this repository are labeled "plugin".
Contributing
If you wish to contribute a new plugin to the Flutter ecosystem, please see the documentation for developing packages and platform channels. You can store your plugin source code in any GitHub repository (the present repo is only intended for plugins developed by the core Flutter team). Once your plugin is ready, you can publish it to the pub repository.
If you wish to contribute a change to any of the existing plugins in this repo, please review our contribution guide, and send a pull request.
Plugins
These are the available plugins in this repository.
Top Related Projects
Flutter Launcher Icons - A package which simplifies the task of updating your Flutter app's launcher icon. Fully flexible, allowing you to choose what platform you wish to update the launcher icon for and if you want, the option to keep your old launcher icon in case you want to revert back sometime in the future. Maintainer: @MarkOSullivan94
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
SQLite flutter plugin
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot