debugMaybeDispatchCreated function

bool debugMaybeDispatchCreated(
  1. String flutterLibrary,
  2. String className,
  3. Object object
)

If memory allocation tracking is enabled, dispatch Flutter object creation.

This method is not member of FlutterMemoryAllocations, because FlutterMemoryAllocations should not increase size of the Flutter application if memory allocations are disabled.

The flutterLibrary argument is the name of the Flutter library where the object is declared. For example, 'widgets' for widgets.dart.

Should be called only from within an assert and only inside Flutter Framework.

Returns true to make it easier to be wrapped into assert.

Implementation

bool debugMaybeDispatchCreated(String flutterLibrary, String className, Object object) {
  if (kFlutterMemoryAllocationsEnabled) {
    FlutterMemoryAllocations.instance.dispatchObjectCreated(
      library: 'package:flutter/$flutterLibrary.dart',
      className: className,
      object: object,
    );
  }
  return true;
}