fromAsset<T, C> static method

Future<NodeGraph<T, C>> fromAsset<T, C>(
  1. String assetPath,
  2. T fromJsonT(
    1. Object? json
    ),
  3. C fromJsonC(
    1. Object? json
    ), {
  4. 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, C>> fromAsset<T, C>(
  String assetPath,
  T Function(Object? json) fromJsonT,
  C Function(Object? json) fromJsonC, {
  Node<T> Function(
    Map<String, dynamic> json,
    T Function(Object? json) fromJsonT,
  )?
  nodeFromJson,
}) async {
  final String jsonString = await rootBundle.loadString(assetPath);
  return fromJsonString<T, C>(
    jsonString,
    fromJsonT,
    fromJsonC,
    nodeFromJson: nodeFromJson,
  );
}