Djangoflow Remote Config Logo

🌐 Djangoflow Remote Config for Flutter 🌐

GitHub Repository Pub Package

A Flutter package for managing remote configurations in your Flutter applications, designed to work seamlessly with django-df-remote-config.


🌟 Features

  • Dynamic Configuration: Load configurations dynamically from the server.
  • Fallback Support: Use fallback configurations when the server is unreachable.
  • Hydrated State: Save and restore state across app launches.
  • Part-based Loading: Load specific parts of the configuration as needed.

📦 Installation

To add djangoflow_remote_config to your Flutter project, add the following line to your pubspec.yaml:

dependencies:
  djangoflow_remote_config: <latest_version>

Then, run:

flutter pub get

🚀 Quick Start

🌅 App Startup

Make sure to call AppLaunchRemoteConfigCubit during your app's startup. This will contain updates of different parts with their last changed DateTime objects.

final appLaunchCubit = AppLaunchRemoteConfigCubit(
  fallbackConfig: {
    // Your fallback configurations here
  },
  params: {
    "app": "com.example.app"
  },
);

appLaunchCubit.load();

🔄 Dynamic Configuration Loading

Use RemoteConfigPartUpdater to load the necessary data based on the last updated time. If the data is not updated, it will use the fallback data or the last hydrated state.

RemoteConfigPartUpdater<AppLaunchRemoteConfigCubit>(
  create: (context) => AppLaunchRemoteConfigCubit(
    // Your configurations here
  ),
  child: YourWidget(),
)

🛠 Parameters

  • fallbackConfig: The default configuration to use if the server is unreachable.
  • params: Additional parameters to send to the server.
  • useOnlyFallbackOnError: Whether to use only the fallback configuration on error.

📖 Example App

Check out the example directory for a complete example app demonstrating the package's capabilities.

🚧 Troubleshooting

If you're encountering issues with Map conversion(specially for json_dyanmic_widget package), please follow these steps for proper configuration:

  1. Open/Create your build.yaml file in your packages that are using json_serializable.
  2. Inside the build.yaml(could be djangoflow_openapi or any application or dart package) file, add the following line:
targets:
  $default:
    builders:
      json_serializable:
        options:
          # Options configure how source code is generated for every
          # `@JsonSerializable`-annotated class in the package.
          #
          # The default value for each is listed.
          any_map: true # <- here
          checked: true
          create_factory: true
          create_to_json: true
          disallow_unrecognized_keys: true
          explicit_to_json: true
          field_rename: none
          ignore_unannotated: false
          include_if_null: false

🤝 Contributing

We welcome contributions! Feel free to open an issue or submit a pull request if you have any improvements or find any bugs.

📜 License

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