check method

  1. @override
Future<void> check()
override

Checks animation.

Implementation

@override
Future<void> check() async {
  print('\n--check'
      '\n\tsource: `$sourcePath`'
      '\n');

  // 1) Checking availability files.
  var step = 1;
  resetCurrentIndent();
  {
    print('$currentIndent$step) Checking availability files'
        ' for animation `${current.path}`...');
    if (!File(pathToFileAtlas).existsSync()) {
      throw Exception('Atlas not found by path `$pathToFileAtlas`.');
    }

    if (!File(pathToFileSkeleton).existsSync()) {
      throw Exception('Skeleton not found by path `$pathToFileSkeleton`.');
    }

    if (!File(pathToFileTexture).existsSync()) {
      throw Exception('Texture not found by path `$pathToFileTexture`.');
    }

    print('$currentIndent\tSuccess check availability'
        ' for animation `${current.path}`.');
  }

  // 2) Checking reference.
  ++step;
  resetCurrentIndent();
  {
    print('$currentIndent$step) Checking reference to texture'
        ' for animation `${current.path}`...');

    final textureAtlas = SpineTextureAtlas(File(pathToFileAtlas));
    if (!textureAtlas.hasReferenceToTexture(fileTexture)) {
      throw Exception('Reference to texture `$fileTexture`'
          ' not found into the file `$pathToFileAtlas`.');
    }

    print('$currentIndent\tSuccess check reference to texture'
        ' for animation `${current.path}`.');
  }
}