import 'dart:convert';
import 'dart:ui';

import 'package:flutter/services.dart';
import 'asset_loader.dart';

class TestAssetLoader extends AssetLoader {
  const TestAssetLoader();

  @override
  Future<Map<String, dynamic>> load(Locale locale) async {
    final data = await rootBundle.load(getAssetPath(locale));
    final bytes =
        data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);

    final strings = utf8.decode(bytes);

    return json.decode(strings) as Map<String, dynamic>;
  }
}
