type_extensions 0.0.2 copy "type_extensions: ^0.0.2" to clipboard
type_extensions: ^0.0.2 copied to clipboard

A small dart package which provides a cleaner interface for dealing with function types

example/type_extensions.dart

import 'dart:io';
import 'package:type_extensions/type_extensions.dart';

// this is much easier to read than
// void run(bool Function(DateTime) fn)
void runApp(UnaryFn<DateTime, bool> app) {
  final isSuccess = app(DateTime.now());
  if (isSuccess) {
    exit(0);
  } else {
    exit(1);
  }
}

void main() {
  runApp((startTime) {
    print('Programme started at $startTime');
    return true;
  });
}
1
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A small dart package which provides a cleaner interface for dealing with function types

Repository (GitLab)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on type_extensions