type_helper 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 85

type_helper #

A type helper that helps to check if a type is a type of another type

Version 0.1

0.1.0 #

  • Initial release


import 'dart:async';

import 'package:type_helper/type_helper.dart';

void main() {
  if (isTypeOf<B<int>, A<num>>()) {
    print('B<int> is type of A<num>');

  if (!isTypeOf<B<int>, A<double>>()) {
    print('B<int> is not a type of A<double>');

  if (isTypeOf<String, Comparable<String>>()) {
    print('String is type of Comparable<String>');

  var b = B<Stream<int>>();

class A<T> {

class B<T> extends A<T> {
  void doIt() {
    if (isTypeOf<T, Stream>()) {
      print('($T): T is type of Stream');

    if (isTypeOf<T, Stream<int>>()) {
      print('($T): T is type of Stream<int>');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  type_helper: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:type_helper/type_helper.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Nov 4, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:type_helper/type_helper.dart.

Health issues and suggestions

Document public APIs. (-1 points)

2 out of 2 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0