14 lines
379 B
Dart
14 lines
379 B
Dart
|
|
import 'dart:convert';
|
||
|
|
|
||
|
|
import 'package:flutter/services.dart' show rootBundle;
|
||
|
|
|
||
|
|
import 'hash_library.dart';
|
||
|
|
|
||
|
|
/// Flutter asset loader for [HashLibrary].
|
||
|
|
Future<HashLibrary> loadHashLibraryAsset({
|
||
|
|
String assetPath = 'data/hashes.json',
|
||
|
|
}) async {
|
||
|
|
final text = await rootBundle.loadString(assetPath);
|
||
|
|
return HashLibrary.fromJson(jsonDecode(text) as Map<String, dynamic>);
|
||
|
|
}
|