fromAsset<T> static method

Future<NodeGraph<T>> fromAsset<T>(
  1. String assetPath,
  2. T fromJsonT(
    1. Object? json
    ), {
  3. Node<T> nodeFromJson(
    1. Map<String, dynamic> json,
    2. T fromJsonT(
      1. Object? json
      )
    )?,
})

Convenience method to load graph from asset file

Implementation

static Future<NodeGraph<T>> fromAsset<T>(
  String assetPath,
  T Function(Object? json) fromJsonT, {
  Node<T> Function(
    Map<String, dynamic> json,
    T Function(Object? json) fromJsonT,
  )?
  nodeFromJson,
}) async {
  final String jsonString = await rootBundle.loadString(assetPath);
  return fromJsonString<T>(jsonString, fromJsonT, nodeFromJson: nodeFromJson);
}