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

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

class RootBundleAssetLoader extends AssetLoader {
  const RootBundleAssetLoader();

  @override
  Future<Map<String, dynamic>> load(Locale locale) async {
    final assetAsString = await rootBundle.loadString(getAssetPath(locale));

    final translations = jsonDecode(assetAsString) as Map<String, dynamic>;

    return translations;
  }
}
