unleash_proxy 0.0.1+1
unleash_proxy: ^0.0.1+1 copied to clipboard
Unleash Flutter Proxy SDK
Unleash Flutter Proxy SDK #
This library is meant to be used with the unleash-proxy. The proxy application layer will sit between your unleash instance and your client applications, and provides performance and security benefits. DO NOT TRY to connect this library directly to the unleash instance, as the datasets follow different formats because the proxy only returns evaluated toggle information.
Installation π» #
β In order to start using Unleash you must have the Flutter SDK installed on your machine.
Add unleash_proxy to your pubspec.yaml:
dependencies:
unleash_proxy:
Install it:
flutter packages get
Usage #
To use the unleash_proxy to your Flutter application read the code example below:
import 'package:example/unleash_environment.dart';
import 'package:flutter/material.dart';
/// Import package here
import 'package:unleash_proxy/unleash_proxy.dart';
Future<void> main() async {
/// Initialize unleash client here
await Unleash.initializeApp(
config: UnleashEnvironment.config,
context: UnleashEnvironment.context,
);
runApp(const App());
}
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Unleash Demo',
theme: ThemeData(
primarySwatch: Colors.purple,
),
home: const UnleashPage(),
);
}
}
class UnleashPage extends StatefulWidget {
const UnleashPage({super.key});
@override
State<UnleashPage> createState() => _UnleashPageState();
}
class _UnleashPageState extends State<UnleashPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Unleash Page'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Toggle Status',
style: TextStyle(height: 2.5, fontWeight: FontWeight.w500),
),
toggleStatus(),
],
),
),
);
}
Widget toggleStatus() {
/// Call [isEnabled] to get the toggle value
final status = Unleash.isEnabled(ToggleKeys.experiment);
return Text(status == true ? 'Enabled' : 'Disabled');
}
}
Can check the example here
Continuous Integration π€ #
Unleash Flutter Proxy SDK comes with a built-in GitHub Actions workflow powered by Very Good Workflows but you can also add your preferred CI/CD solution.
Out of the box, on each pull request and push, the CI formats, lints, and tests the code. This ensures the code remains consistent and behaves correctly as you add functionality or make changes. The project uses Very Good Analysis for a strict set of analysis options used by our team. Code coverage is enforced using the Very Good Workflows.
Running Tests π§ͺ #
For first time users, install the very_good_cli:
dart pub global activate very_good_cli
To run all unit tests:
very_good test --coverage
To view the generated coverage report you can use lcov.
# Generate Coverage Report
genhtml coverage/lcov.info -o coverage/
# Open Coverage Report
open coverage/index.html
Issues #
Please file any issues, bugs or feature requests as an issue on the GitHub page. Commercial support is available, you can contact me at rizentium@gmail.com.
Author #
This unleash_proxy plugin for Flutter is developed by Arif Hidayat.