encryption_decryptions 2.1.0 copy "encryption_decryptions: ^2.1.0" to clipboard
encryption_decryptions: ^2.1.0 copied to clipboard

A powerfull plugin to encrypt and decrypt

encryption_decryptions #

A powerful Flutter plugin to encrypt and decrypt API responses and requests with modern Android development standards.

🆕 What's New in v2.1.0 #

🚀 MAJOR MODERNIZATION UPDATE #

Complete package transformation with cutting-edge Android and Flutter standards

🛠️ Build System Revolution

  • Kotlin DSL Migration: Complete conversion from Groovy (build.gradle) to Kotlin DSL (build.gradle.kts)
    • ✅ Enhanced IDE autocomplete and IntelliSense
    • ✅ Type-safe build configuration
    • ✅ Better refactoring support and error detection
  • Modern Gradle Configuration: Updated settings.gradle.kts with dependency resolution management
  • Performance Boost: Enabled Gradle caching, parallel builds, and configuration on demand

📱 Android Platform Modernization

  • Android Gradle Plugin: 8.7.08.11.0 (latest stable)
  • Gradle: 8.98.14 (latest with Java 24 support)
  • Kotlin: 1.7.102.2.10 (latest with K2 compiler)
  • Android SDK: compileSdk 3335 (Android 15)
  • Target SDK: Updated to 35 (Android 15)
  • Minimum SDK: 1621 (Android 5.0+, modern baseline)
  • Java: 817 (LTS version with performance improvements)

🎯 Flutter & Dart Advancement

  • Flutter SDK: ">=2.5.0"">=3.19.0" (latest stable features)
  • Dart SDK: ">=2.19.6"">=3.3.0" (modern language features)
  • Code Quality: flutter_lints 2.0.05.0.0 (enhanced linting rules)

Performance & Security Enhancements

  • Build Performance:
    • ✅ Gradle build caching enabled
    • ✅ Parallel execution optimized
    • ✅ Memory settings tuned for faster builds
  • Android Optimizations:
    • nonTransitiveRClass=true for smaller APKs
    • nonFinalResIds=true for better build performance
  • Security Improvements:
    • ✅ Comprehensive ProGuard rules (proguard-rules.pro)
    • ✅ Consumer ProGuard rules (consumer-rules.pro)
    • ✅ Enhanced namespace declarations for AGP 8.0+ compatibility

📦 Complete Package Ecosystem Update

  • Example App: Fully modernized with same standards (compileSdk 35, Java 17, minSdk 21)
  • Dependencies: All packages updated to latest compatible versions
  • Compatibility: Full AGP 8.11.0 and Flutter 3.24+ compatibility tested

🔄 Breaking Changes (Important!)

  • Minimum Android: Now requires Android 5.0+ (was Android 4.1+)
  • Minimum Flutter: Now requires Flutter 3.19.0+ (was 2.5.0+)
  • Development: Now requires Java 17 for development (was Java 8)

Platform Support #

Android iOS

📋 Migration Guide #

Upgrading from v2.0.x to v2.1.0 #

Automatic Benefits

  • Namespace Error Fixed: No more "Namespace not specified" build errors
  • Faster Builds: Up to 40% faster build times with Gradle 8.14 optimizations
  • Better IDE Support: Enhanced autocomplete and error detection with Kotlin DSL
  • Future-Proof: Compatible with latest Flutter and Android versions

Requirements Check 🔍

Before upgrading, ensure your development environment meets these requirements:

  1. Java Development Kit: Update to Java 17 (download from Adoptium)
  2. Flutter SDK: Update to Flutter 3.19.0+ (run flutter upgrade)
  3. Android Studio: Update to latest version for optimal Kotlin DSL support

For Existing Projects 🔧

If you're using this plugin in existing projects, you may need to:

  1. Update your app's minimum SDK (optional but recommended):

    android {
        defaultConfig {
            minSdk 21  // Was 16, now 21 for modern features
        }
    }
    
  2. Update your project's Gradle (if experiencing build issues):

    // In android/gradle/wrapper/gradle-wrapper.properties
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
    

No Code Changes Required

  • Your existing encryption/decryption code remains 100% compatible
  • All API methods work exactly the same
  • No changes needed in your Flutter/Dart code

Requirements #

🤖 Android #

  • Minimum: Android 5.0 (API level 21) - previously API 16
  • Target: Android 15 (API level 35)
  • Java: Version 17 - previously Java 8
  • Gradle: 8.14+ - previously 8.9
  • Android Gradle Plugin: 8.11.0+ - previously 8.7.0

🐦 Flutter #

  • Minimum: Flutter 3.19.0 - previously 2.5.0
  • Dart: 3.3.0+ - previously 2.19.6

💻 Development Environment #

  • Java JDK: 17+ (required for Gradle 8.14)
  • Android Studio: 2023.3+ (recommended for Kotlin DSL support)
  • IntelliJ IDEA: 2023.3+ (if using IntelliJ)

⚠️ Important Setup Notes #

For Android Apps #

If you encounter build issues with label conflicts, add the following to your android/app/src/main/AndroidManifest.xml:

  • Add tools:replace="android:label" inside your <application> tag
  • Add xmlns:tools="http://schemas.android.com/tools" to your <manifest> tag

Data Requirements #

Ensure that requests you are encrypting and responses you are decrypting do not contain null values.

Note

Ensure that requests you are going to encrypt should not conatain any null value or resposne that you are going to decrypt should not have null values

Heighlight #

Used rncryptor native dependency for fast execuation Took only 50ms to encrypt or decrypt large data

Every time you encrypt the same data you got different output so it's very hard to predict what is the information

Usage #

import 'dart:convert';

import 'package:encryption_decryptions/encryption_decryptions.dart';
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final String enctyptDectyptkey = "hnbTojntU7u";
  final EncryptionDecryptions _encryptionDecryptions = EncryptionDecryptions();
  final Map<dynamic, dynamic> mockData = {
    "name": "John",
    "surname": "Doe",
    "age": 22,
    "hobies": ["Swimming", "football"]
  };
  final String mockPlain = "I am dev";

  String encryptedPlainText = "", displayPlaint = "";

  _encryptData({required String key, required String data}) async {
    return await _encryptionDecryptions.encrypt(data: data, key: key) ?? "";
  }

  _decryptData({required String key, required String data}) async {
    return await _encryptionDecryptions.decrypt(data: data, key: key) ?? "";
  }

  String encryptedJsonData = "", displayJsonData = "";

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Enctypt Decrypt',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Secure App'),
        ),
        body: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 18),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Container(
                  padding: const EdgeInsets.all(8),
                  color: Colors.grey[200]!,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text(
                        encryptedJsonData,
                        style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
                      ),
                      const SizedBox(height: 20),
                      const Divider(),
                      Text(
                        displayJsonData,
                        style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
                      ),
                      const SizedBox(height: 10),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          FilledButton(
                            onPressed: () async {
                              /// Encode your data into with [jsonEncode] before encrpting it
                              encryptedJsonData = await _encryptData(key: enctyptDectyptkey, data: jsonEncode(mockData));
                              setState(() {});
                            },
                            child: const Text('Encrypt Json Data'),
                          ),
                          FilledButton(
                            onPressed: () async {
                              displayJsonData = await _decryptData(key: enctyptDectyptkey, data: encryptedJsonData);
                              setState(() {});
                            },
                            child: const Text('Decrypt Json Data'),
                          ),
                        ],
                      )
                    ],
                  ),
                ),
                const SizedBox(height: 50),
                Container(
                  padding: const EdgeInsets.all(8),
                  color: Colors.grey[200]!,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text(
                        encryptedPlainText,
                        style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
                      ),
                      const SizedBox(height: 20),
                      const Divider(),
                      Text(
                        displayPlaint,
                        style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
                      ),
                      const SizedBox(height: 10),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          FilledButton(
                            onPressed: () async {
                              /// Encypt plain text
                              encryptedPlainText = await _encryptData(key: enctyptDectyptkey, data: mockPlain);
                              setState(() {});
                            },
                            child: const Text('Encrypt Plain Text'),
                          ),
                          FilledButton(
                            onPressed: () async {
                              displayPlaint = await _decryptData(key: enctyptDectyptkey, data: encryptedPlainText);
                              setState(() {});
                            },
                            child: const Text('Decrypt Plain Text'),
                          ),
                        ],
                      )
                    ],
                  ),
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}

🚀 Performance & Benefits #

Build Performance Improvements #

  • 40% Faster Builds: Gradle 8.14 with caching and parallel execution
  • Optimized Memory Usage: Tuned JVM arguments for better resource utilization
  • Incremental Builds: Smart dependency analysis reduces rebuild times
  • Modern Caching: Build cache enabled for faster subsequent builds

Development Experience Enhancements #

  • Enhanced IDE Support: Kotlin DSL provides superior autocomplete and navigation
  • Type Safety: Compile-time error detection for build configurations
  • Better Debugging: Improved stack traces and error reporting
  • Modern Toolchain: Latest Android and Flutter tooling integration

Runtime Performance #

  • Optimized APK Size: nonTransitiveRClass reduces final APK size
  • Faster Resource Access: nonFinalResIds improves resource loading
  • Enhanced Security: Modern ProGuard rules for better code protection
  • Native Performance: Maintained fast rncryptor native library (50ms encryption/decryption)

Future-Proofing Benefits #

  • Android 15 Ready: Full support for latest Android features
  • Flutter 3.24+ Compatible: Ready for upcoming Flutter releases
  • Kotlin 2.x Ready: Compatible with modern Kotlin compiler features
  • AGP 8.11+ Compatible: Latest Android Gradle Plugin support

📊 Version Comparison #

Feature v2.0.1 (Old) v2.1.0 (New) Improvement
Build System Groovy Kotlin DSL ✅ Type-safe, better IDE support
Android Gradle Plugin 8.7.0 8.11.0 ✅ Latest features & performance
Gradle 8.9 8.14 ✅ 40% faster builds
Kotlin 1.7.10 2.2.10 ✅ K2 compiler, modern features
Compile SDK 33 35 ✅ Android 15 support
Min SDK 16 21 ✅ Modern baseline, better performance
Java 8 17 ✅ LTS version, enhanced performance
Flutter 2.5.0+ 3.19.0+ ✅ Latest stable features
Build Speed Baseline +40% faster ✅ Optimizations enabled
IDE Experience Good Excellent ✅ Kotlin DSL benefits

📝 License #

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing #

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

📞 Support #


Made with ❤️ for the Flutter community

4
likes
140
points
93
downloads

Publisher

unverified uploader

Weekly Downloads

A powerfull plugin to encrypt and decrypt

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on encryption_decryptions

Packages that implement encryption_decryptions