discloud_config 1.0.3 copy "discloud_config: ^1.0.3" to clipboard
discloud_config: ^1.0.3 copied to clipboard

A configuration file handler to use with Discloud host

pub package package publisher

A configuration file handler to use with Discloud host

Discord

Installation #

Add it to your pubspec.yaml as a dependencies by running the following command.

dart pub add discloud_config

Usage #

Import #

import 'package:discloud_config/discloud_config.dart

Make an instance #

/// the [lines] argument receives a list of lines from the configuration file contents
DiscloudConfig(File, [List<String>?]);
  • It can also be asynchronous
// import 'dart:io';
await DiscloudConfig.fromFileSystemEntity(FileSystemEntity);
await DiscloudConfig.fromPath(String);
await DiscloudConfig.fromUri(Uri);

Watch configuration file #

// Stream<DiscloudConfigData>
await for (final DiscloudConfigData data in config.watch()) {
  // ...
}

Create a new DiscloudConfigData from JSON #

DiscloudConfigData.fromJson(Map<String, dynamic>);

Updating DiscloudConfigData #

// Convert to raw data
final Map<String, dynamic> oldRawData = oldData.toJson();

// Update raw data
oldRawData["TYPE"] = "bot";

// Convert to data
final newData = DiscloudConfigData.fromJson(oldRawData);

List all configuration files recursively #

// Stream<File>
await for (final File file in listDiscloudConfigFiles(Directory)) {
  // ...
}

Recursively list configuration structures by ID #

// Stream<DiscloudConfig>
await for (final DiscloudConfig config in listDiscloudConfigByAppId(Directory, String)) {
  // ...
}

Contributing #

We welcome a diverse set of contributions, including, but not limited to:

For the stability of the API and existing users, consider opening an issue first before implementing a large new feature or breaking an API. For smaller changes (like documentation, minor bug fixes), just send a pull request.

Testing #

All pull requests are validated against CI, and must pass.

Ensure build runs

dart run build_runner build

Ensure code passes all our analyzer checks:

dart analyze

Ensure all code is formatted with the latest dev-channel SDK.

dart format .

Run all of our unit tests:

dart test
0
likes
150
points
200
downloads

Publisher

verified publisherdiscloud.com

Weekly Downloads

A configuration file handler to use with Discloud host

Homepage
Repository (GitHub)
View/report issues

Topics

#discloud #parser

Documentation

Documentation
API reference

License

Apache-2.0 (license)

Dependencies

json_annotation, path

More

Packages that depend on discloud_config