Skip to content

Instantly share code, notes, and snippets.

@miquelbeltran
Created July 3, 2020 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miquelbeltran/a357b97218d7ebf64c8d94531e5c9f4a to your computer and use it in GitHub Desktop.
Save miquelbeltran/a357b97218d7ebf64c8d94531e5c9f4a to your computer and use it in GitHub Desktop.
Dart Live Templates for built_value
/// built_value template
/// variables:
/// CLASS_NAME
abstract class $CLASS_NAME$ implements Built<$CLASS_NAME$, $CLASS_NAME$Builder> {
factory $CLASS_NAME$([void Function($CLASS_NAME$Builder) updates]) = _$$$CLASS_NAME$;
$CLASS_NAME$._();
}
/// Serializer
/// CLASS_NAME dartClassName() skip if defined: true
/// CLASS_NAME_CAMEL camelCase(dartClassName()) skip if defined: true
static Serializer<$CLASS_NAME$> get serializer => _$$$CLASS_NAME_CAMEL$Serializer;
/// Enum
/// ENUM_NAME
/// ENUM_NAME_CAMEL camelCase($ENUM_NAME$) skip if defined true
/// VALUE
class $ENUM_NAME$ extends EnumClass {
static Serializer<$ENUM_NAME$> get serializer => _$$$ENUM_NAME_CAMEL$Serializer;
static const $ENUM_NAME$ $VALUE$ = _$$$VALUE$;
const $ENUM_NAME$._(String name) : super(name);
static BuiltSet<$ENUM_NAME$> get values => _$values;
static $ENUM_NAME$ valueOf(String name) => _$valueOf(name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment