dart_pre_commit 2.0.0-nullsafety.0 copy "dart_pre_commit: ^2.0.0-nullsafety.0" to clipboard
dart_pre_commit: ^2.0.0-nullsafety.0 copied to clipboard

outdated

A small collection of pre commit hooks to format and lint dart code

example/main.dart

import 'dart:io';

import 'package:dart_pre_commit/dart_pre_commit.dart';
import 'package:riverpod/riverpod.dart'; // ignore: import_of_legacy_library_into_null_safe

Future<void> main(List<String> arguments) async {
  // assume first arg is the git directory to handle
  Directory.current = arguments.first;

  // optional: create an IoC-Container for easier initialization of the hooks
  final container = ProviderContainer();

  // obtain the hooks instance from the IoC with your custom config
  final hook =
      await container.read(HooksProvider.hookProvider(const HooksConfig(
    fixImports: true,
    // ignore: avoid_redundant_argument_values
    analyze: false,
  )).future);

  // alternatively, you can instanciate Hooks directly:
  // final hook = Hooks(...);

  // run all hooks
  final result = await hook();

  // report the result
  exitCode = result.isSuccess ? 0 : 1;
}
17
likes
0
pub points
78%
popularity

Publisher

verified publisherskycoder42.de

A small collection of pre commit hooks to format and lint dart code

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

args, convert, crypto, meta, path, pub_semver, riverpod, yaml

More

Packages that depend on dart_pre_commit