carv_generators

Creator: coderz1093

Last updated:

0 purchases

carv_generators Image
carv_generators Images

Languages

Categories

Add to Cart

Description:

carv generators

Generators -
Annotations -
Provides Dart Build System builders for Generating boilerplate code for Carv app.
The builders generate code when they find classes/functions annotated with classes defined in package:carv_annotations.
Supporting Builders #
- Model Validate function (will be generate as an Extension)
copied to clipboard
Setup #
To configure your project with carv_generators follow these steps;
Add dependencies in your pubspec.yaml file.
dependencies:
carv_annotations: ^latest-version

dev_dependencies:
build_runner:
carv_generators: ^latest-version
copied to clipboard
create a build.yaml file in the root app folder and add the below code block.
targets:
$default:
builders:
carv_generators|modelValidatableGenerator:
enabled: true
generate_for:
- lib/**_model.dart
copied to clipboard
Given your Domain model is meeting_model.dart:
import 'package:carv_annotations/carv_annotations.dart';

part 'meeting_model.g.dart';

@ModelValidate([
Validatable('name', Validator(ValidatorType.required)),
Validatable('email', Validator(ValidatorType.email)),
Validatable('password', Validator(ValidatorType.minLength, matcher: 8)),
])
class MeetingModel {
@override
final Meeting data; // your pb data model :-> Meeting(name, email, password)

// the rest of the code
// goes below
}
copied to clipboard
Then run the following command to generate code for you.
flutter pub run build_runner build
copied to clipboard
or
flutter pub run build_runner build --delete-conflicting-outputs
copied to clipboard
TODO: #
- Improve test coverage
- Add more generators
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.