config_map 0.1.0 copy "config_map: ^0.1.0" to clipboard
config_map: ^0.1.0 copied to clipboard

retracted

Helper class for converting string values of object in predefined types and for editing ones

Config map #

Convert Map<String,String?> to object with multitype fields. Add ability to edit ones.

Features #

  • Simple config (list)
  • List of used and unused fields for creating of interactive forms ()
  • Global getter and setter

Getting started #

dart pub add config_map
#or
flutter pub add config_map

Usage #

to /example folder.

import 'package:config_map/config_map.dart';

// <T extends Enum>
final myMapConfig = {
  'title': 'Title of book',
  'description': 'Description of book', 
  'authors': 'John Author\nJain Author',
  'show': 'true',
  'count': '123',
};

enum FieldNames {
  title,description, authors, show
}
List<ConfigMapItem> fields = [
  ConfigMapItem('title', ConfigMapType.string),
  ConfigMapItem('description', ConfigMapType.multiline),
  ConfigMapItem('authors', ConfigMapType.strings),
  ConfigMapItem('show', ConfigMapType.bool),
  ConfigMapItem('count', ConfigMapType.int),
];

void main() {
  final config = ConfigMap<FieldNames>(fields, json: myMapConfig);

  final String title = config.get('title');
  final bool show = config.get('show');
  final int count = config.get('count'); // 123
  final int countInt = config.getAs<int>('count'); // 123
  final List<String> authors = config.get('authors'); // ['John Author', 'Jain Author']

  config.setSingle('count', 456);
  final String countStr = config.getString('count'); // '456'
  final int countNext = config.getAs<int>('count'); // 456

  config.setList('author', ['Bob', 'Bill']);
  final List<String> authorsNext = config.get('authors'); // ['Bob', 'Bill']
  final List<String> authorsStr = config.getString('authors'); // 'Bob\nBill'
}

Additional information #

enum ConfigMapType #

Enum type Dart type Widget
string String One-line TextField
multiline String Multiline TextField
select String Custom select Widget
bool bool Switch
int int TextField
intSelect int Custom select Widget
double double TextField
doubleSelect double Custom select Widget
strings List<String> List of TextField
multiselect List<String> Custom select Widget
ints List<int> List of TextField
intMultiselect List<int> Custom select Widget
doubles List<double> List of TextField
doubleMultiselect List<double> Custom select Widget
0
likes
0
points
639
downloads

Publisher

unverified uploader

Weekly Downloads

Helper class for converting string values of object in predefined types and for editing ones

Repository (GitHub)
View/report issues

Topics

#map #object #data #converting

License

unknown (license)

Dependencies

collection

More

Packages that depend on config_map