in_app_remote 1.0.1 copy "in_app_remote: ^1.0.1" to clipboard
in_app_remote: ^1.0.1 copied to clipboard

A lightweight Flutter package for remote in-app configuration and testing. It allows developers to fetch, update, and validate app settings dynamically without requiring a full app release. Built-in s [...]

example/lib/main.dart

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

class MyRemoteDelegate extends RemoteDelegate {
  @override
  Future<Map<String, dynamic>> fetch(String remoteName, String path) async {
    // Simulate network request
    await Future.delayed(Duration(seconds: 1));
    return {'message': 'Hello from remote for $path'};
  }

  @override
  Future<Map<String, dynamic>?> cache(String remoteName, String path) async {
    // Return cached data if any (optional)
    return null;
  }

  @override
  Future<String> asset(String remoteName, String path) async {
    // Load asset JSON (optional)
    return '{"message": "Hello from asset for $path"}';
  }

  @override
  Stream<Map<String, dynamic>?> listen(String remoteName, String path) {
    // Return a stream to simulate live updates
    return Stream.periodic(
      Duration(seconds: 5),
      (count) => {'message': 'Update #$count for $path'},
    );
  }

  @override
  Future<bool> save(String remoteName, String path, Map? data) async {
    // Save data to cache or local storage
    return true;
  }
}

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Create Remote instance
  final remote = Remote<MyRemoteDelegate>();

  // Initialize remote
  await remote.initialize(
    name: 'myRemote',
    connected: true,
    delegate: MyRemoteDelegate(),
    paths: {'greetings'},
    listening: true,
    showLogs: true,
    onReady: () => print('Remote is ready!'),
  );

  // Listen to changes
  remote.addListener(() {
    print('Data updated: ${remote.props}');
  });

  // Reload data manually
  await remote.reload();
}
1
likes
150
points
18
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A lightweight Flutter package for remote in-app configuration and testing. It allows developers to fetch, update, and validate app settings dynamically without requiring a full app release. Built-in support for unit tests and widget tests ensures configurations behave as expected across different environments.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on in_app_remote