ETCD Dart Client

A Dart package for interacting with etcd, a distributed key-value store.


Add etcd_client to your pubspec.yaml:

  etcd_client: ^0.0.3-beta // Use latest version

Run dart pub get to fetch the package.

Usage Import and initialize EtcdClient with your etcd server URL and optional credentials (username and password). Use the provided methods (put, get, update, delete) to interact with etcd.

Copy code
import 'package:etcd_client/etcd_client.dart';

void main() async {
  final etcdUrl = 'http://localhost:2379'; // Replace with your etcd server URL
  final etcdClient = EtcdClient(
    etcdUrl: etcdUrl,
    username: 'your_username',
    password: 'your_password',

  // Example of putting a key-value pair
  try {
    await etcdClient.put('/my/key', 'Hello, etcd!');
    print('Key-value pair added successfully.');
  } catch (e) {
    print('Failed to add key-value pair: $e');

  // Example of getting a value for a key
  try {
    final value = await etcdClient.get('/my/key');
    print('Value for key /my/key: $value');
  } catch (e) {
    print('Failed to get value for key /my/key: $e');

  // Example of updating a key-value pair
  try {
    await etcdClient.update('/my/key', 'Updated value');
    print('Key-value pair updated successfully.');
  } catch (e) {
    print('Failed to update key-value pair: $e');

  // Example of deleting a key
  try {
    await etcdClient.delete('/my/key');
    print('Key deleted successfully.');
  } catch (e) {
    print('Failed to delete key: $e');

  // Close the client when done

API Reference

EtcdClient class Constructors EtcdClient({String etcdUrl, String username, String password}): Creates a new etcd client instance.


Future<void> put(String key, String value): Stores a key-value pair in etcd. Future<String> get(String key): Retrieves the value associated with a key from etcd. Future<void> update(String key, String value): Updates the value for a key in etcd. Future<void> delete(String key): Deletes a key from etcd. void close(): Closes the HTTP client when done.


Replace your_username and your_password with your etcd credentials. Ensure your etcd server URL (etcdUrl) is correct and accessible. Handle errors and exceptions gracefully in your application. Consider security best practices for handling credentials securely. Contributing Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.


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


Thank you to the Dart community and contributors who have helped improve this package.


Support for doing something awesome.