Flutter gallery: import show

I am starting to read code of Flutter gallery project, there are something I am not familiar, the import show is one of them.

In main.dart file on the gallery project, there has a line like below:import 'package:flutter/scheduler.dart' show timeDilation;

I am not familiar with the show keyword, so I search the internet, and find the dart document Libraries and visibility section. there are some description about import show.

  • import: Import a library.import 'dart:html';
    import 'package:test/test.dart';
  • import as: Specify a library prefix, for example two libraries has same identifiers, we can specify a prefix for one of library, so with the prefix we can call the specify identifier.import 'package:lib1/lib1.dart';
    import 'package:lib2/lib2.dart' as lib2;

    // Uses Element from lib1.
    Element element1 = Element();

    // Uses Element from lib2.
    lib2.Element element2 = lib2.Element();
  • import show: Only import part of the library, show will only import one of the identifier from the library.// Import only foo.
    import 'package:lib1/lib1.dart' show foo;
  • import hide: Import all the identifiers except the name in the hide.// Import all names EXCEPT foo.
    import 'package:lib2/lib2.dart' hide foo;