barbarian 0.2.26+10

  • Readme
  • Changelog
  • Example
  • Installing
  • 84

Barbarian #

pub package

Barbarian is a fast and simple way to save data in NoSQL. It is a simple wrap of Shared preferences.

Initialize Barbarian #

await Barbarian.init();

Save #

Save any object, Map, List, HashMap etc. including all internal objects. Use your existing data classes as is.

Barbarian.write('string', 'cadena');
Barbarian.write('bool', true);
Barbarian.write('integer', 7);
Barbarian.write('double', 3.8);

Read #

Read data objects is as easy as

String str ='string');
bool boole ='bool');
int ibtg ='integer');
double doub ='double');

Delete #

Delete data for one key.


Remove all keys


Get all keys #

Returns all keys for objects in the book.

List<String> allKeys = Barbarian.getAllKeys();

Complex data #

To save an object it is important that it has some form of serialization. Like this

class Item {
  int id;
  String name;
  List<String> locations;
  double price;
  int stock;
  bool active;


  Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'locations': locations,
        'price': price,
        'stock': stock,
        'active': active

  Item.fromMap(Map<String, dynamic> map)
      : id = map['id'],
        name = map['name'],
        locations = List<String>.from(map['locations']),
        price = map['price'],
        stock = map['stock'],
        active = map['active'];

  String toString() => toJson().toString();

Save #

Barbarian.write('item', item);

Read #

Item oldItem ='item', customDecode: (output) => Item.fromMap(output));

If you need more examples of complex data you can review the tests here.

[0.2.26+10] - 25/06/2020 #

  • @kranfix fix as IpaObject save

[0.2.26+9] - 25/06/2020 #

  • @kranfix Fix ValueListenable

[0.2.26+8] - 26/05/2020 #

  • @kranfix Add IpaObject and IpaList
  • @kranfix Add ValueListenable support

[0.2.26+6] - 30/04/2020 #

  • Add web support

[0.2.26+4] - 09/05/2019 #

  • Add null exception

[0.2.26] - 09/05/2019 #

  • Create first version of Barbarian


import 'package:barbarian/barbarian.dart';
import 'package:barbarian_example/children.dart';
import 'package:flutter/material.dart';

import 'person.dart';

void main() {

class BarbarianApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Barbarian Demo',
      theme: ThemeData.dark(),
      home: BarbarianPage(),

class BarbarianPage extends StatefulWidget {
  _BarbarianPageState createState() => _BarbarianPageState();

class _BarbarianPageState extends State<BarbarianPage> {
  Person _brian = Person() = 'Brian'
    ..last = 'Castillo';

  Children children = Children();

  void initState() {

    WidgetsBinding.instance.addPostFrameCallback((_) async {
      await Barbarian.init();

      children.addChild('Brian', 'Castillo');

      await Future.delayed(Duration(seconds: 2)); = 'Carlos';;

      children.addChild('Carlos', 'Ramirez');

      await Future.delayed(Duration(seconds: 2)); = 'Frank';;

      children.addChild('Frank', 'Moreno');

      await Future.delayed(Duration(seconds: 2)); = 'Pierre';;

      children.addChild('Pierre', 'Guillen');

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Barbarian'),
      body: SizedBox.expand(
        child: Column(
          children: [
              valueListenable: _brian.listen(_brian),
              builder: (context, value, _) {
                print('person $value');
                return Text('Hi ${value?.name}');
              valueListenable: children.listen(),
              builder: (context, value, _) {
                print('children $value');
                return Text('Children ${value?.length ?? 0}');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  barbarian: ^0.2.26+10

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:barbarian/barbarian.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 6, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:barbarian/barbarian.dart, package:shared_preferences/shared_preferences.dart] that declares support for platforms: android, ios, macos, web

Package does not support Flutter platform windows

Because of import path [package:barbarian/barbarian.dart, package:shared_preferences/shared_preferences.dart] that declares support for platforms: android, ios, macos, web

Package not compatible with SDK dart

because of import path [barbarian] that is in a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

40 out of 40 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/ipa.dart.

Run flutter format to format lib/ipa.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
shared_preferences ^0.5.7+3 0.5.7+3
shared_preferences_web ^0.1.2+7 0.1.2+7
synchronized ^2.2.0+1 2.2.0+1
Transitive dependencies
collection 1.14.12 1.14.13
flutter_web_plugins 0.0.0
meta 1.1.8 1.2.1
shared_preferences_macos 0.0.1+10
shared_preferences_platform_interface 1.0.4
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
test ^1.14.2