mutable_wrappers 1.0.0 copy "mutable_wrappers: ^1.0.0" to clipboard
mutable_wrappers: ^1.0.0 copied to clipboard

wraps basic dart data types and objects in class with mutable field. It can be used in classes which marked as @immutable.

mutable_wrappers

Package contains classes to wrap basic dart data types and objects in class with mutable field. It can be used in classes which marked as @immutable.

How It Looks

class Mutable{Type} {
  {Type} wrapped;
  Mutable{Type}(this.wrapped);
}

How It Can Be Used

@immutable
class SomeWidget extends StatefullWidget {
    final MutableString text;
    SomeWidget({@required this.text})
    ...
}

_SomeWidgetState {
    ...

    widget.text.wrapped = controller.text;

    ...
}

Screen {
    final textToCommit = MutableString("");
    ...
    SomeWidget(text: textToCommit)
    ...
    Button (
        onTap: () {
            validate(textToCommit.wrapped);

            database.push(textToCommit.wrapped);
        }
    )
}

How classes are called

  • MutableObject (Object)
  • MutableString (String)
  • MutableInteger (int)
  • MutableFloat (double)
  • MutableBool (bool)
  • MutableStream (Stream)
  • MutableList (List)
  • MutableMap (Map)
  • MutableSet (Set)
  • MutableFunction (Function)
  • MutableDynamic (Dynamic)
10
likes
40
pub points
0%
popularity

Publisher

unverified uploader

wraps basic dart data types and objects in class with mutable field. It can be used in classes which marked as @immutable.

Repository (GitHub)
View/report issues

License

LGPL-2.1 (LICENSE)

More

Packages that depend on mutable_wrappers