Installation
Complete installation guide for Flutter Policy Engine
Installation Guide
This guide covers everything you need to install and set up the Flutter Policy Engine in your project.
๐ Prerequisites
Before installing Flutter Policy Engine, ensure you have:
- Flutter SDK: Version 3.0.0 or higher
- Dart SDK: Version 2.17.0 or higher
- Android Studio or VS Code with Flutter extensions
- Git for version control
1. Add to pubspec.yaml
Add the Flutter Policy Engine dependency to your pubspec.yaml
file:
dependencies:
flutter:
sdk: flutter
flutter_policy_engine: ^1.0.0
3. Verify Installation
Check that the package was installed correctly:
flutter pub deps
You should see flutter_policy_engine
listed in the dependencies.
Android
No additional setup required for Android. The package works out of the box with Android apps.
Desktop (Windows, macOS, Linux)
For desktop applications, ensure you have desktop support enabled:
# For Windows
flutter config --enable-windows-desktop
# For macOS
flutter config --enable-macos-desktop
# For Linux
flutter config --enable-linux-desktop
Testing the Installation
Create a simple test to verify the installation:
import 'package:flutter/material.dart';
import 'package:flutter_policy_engine/flutter_policy_engine.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Test basic functionality
final policyManager = PolicyManager();
await policyManager.initialize({
"test": ["test_content"]
});
print("Flutter Policy Engine installed successfully!");
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Installation Test',
home: Scaffold(
appBar: AppBar(title: Text('Installation Test')),
body: Center(
child: Text('Flutter Policy Engine is working!'),
),
),
);
}
}
๐ Updating the Package
To update to the latest version:
flutter pub upgrade flutter_policy_engine
To update to a specific version:
flutter pub add flutter_policy_engine:^1.1.0
Uninstalling
To remove the package from your project:
- Remove the dependency from
pubspec.yaml
- Run
flutter pub get
- Remove any import statements from your code
Issue: Package not found
Solution: Ensure you have a stable internet connection and try:
flutter pub cache clean
flutter pub get
Issue: Version conflicts
Solution: Check for version conflicts in your pubspec.yaml
:
flutter pub deps --style=tree
Issue: Flutter version compatibility
Solution: Update Flutter to the latest stable version:
flutter upgrade
flutter doctor
๐ Next Steps
After successful installation:
- Quick Start: Get up and running in minutes
- Examples: Explore working examples
- API Reference: Learn about the available APIs
๐ค Getting Help
If you encounter installation issues:
- Check the Flutter documentation
- Review the pub.dev package page
- Open an issue on the GitHub repository
- Check the troubleshooting guide