printLibrary function

Library printLibrary(
  1. String style,
  2. Iterable<_IconResult> icons
)

Implementation

Library printLibrary(String style, Iterable<_IconResult> icons) {
  return Library(
    (b) => b
      ..directives = ListBuilder(
        [Directive.import("package:flutter/widgets.dart")],
      )
      ..body = ListBuilder(
        [
          Class(
            (b) => b
              ..name = ReCase("f_a_${style}").pascalCase
              ..constructors = ListBuilder([Constructor((b) => b..name = "_")])
              ..fields = ListBuilder([
                ...icons.map((e) => e.toField()),
                Field(
                  (b) => b
                    ..name = '_fontFamily'
                    ..static = true
                    ..modifier = FieldModifier.constant
                    ..assignment = literalString(
                      ReCase("font-awesome-${style}").pascalCase,
                    ).code,
                )
              ]),
          )
        ],
      ),
  );
}