How to get a list of all loaded libraries in dart?

Issue

Is it possible to make some call from main to get all the loaded libraries at runtime?

main(){
  Iterable<LibraryMirror> libraries = getAllLoadedLibraries();
}

I see there is a Type LibraryMirror in the mirrors package but I don’t see how you would get a library mirror since you can’t just reference them in code like a top level function/variable or class name.

Solution

import 'dart:mirrors`;

currentMirrorSystem().libraries;

Answered By – Günter Zöchbauer

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.