mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-23 16:00:41 +00:00
15 lines
569 B
Dart
15 lines
569 B
Dart
|
import 'dart:convert';
|
||
|
import 'dart:io';
|
||
|
|
||
|
import '../models/screenshot_config.dart';
|
||
|
|
||
|
Map<String, ScreenshotConfig> parseScreenshotConfigs([String locale = 'en']) {
|
||
|
final configPath = 'screenshots/assets/content/screenshot_titles_$locale.json';
|
||
|
final data = jsonDecode(File(configPath).readAsStringSync()) as Map<String, dynamic>;
|
||
|
final entries = (data['screenshots'] as List).map((value) {
|
||
|
final config = ScreenshotConfig.fromJson(value as Map<String, dynamic>);
|
||
|
return MapEntry(config.screenshotName, config);
|
||
|
});
|
||
|
return Map.fromEntries(entries);
|
||
|
}
|