Resolve all lints and deprecation warnings

This commit is contained in:
2026-01-09 10:04:51 -06:00
parent 512577b092
commit a799e9cf59
56 changed files with 2819 additions and 3159 deletions

View File

@@ -7,7 +7,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:path_provider_platform_interface/path_provider_platform_interface.dart';
import 'package:path_provider_linux/path_provider_linux.dart';
import 'package:mockito/mockito.dart';
import 'mocks.mocks.dart'; // Generated mock file
@@ -36,7 +35,7 @@ void main() {
// Initialize path_provider_platform_interface for testing
// This is a common pattern for mocking platform-specific plugins in tests.
PathProviderPlatform.instance = _MockPathProviderPlatform();
testPath = Directory.current.path + '/test_hive_temp';
testPath = '${Directory.current.path}/test_hive_temp';
// Ensure the directory exists
final Directory tempDir = Directory(testPath);
@@ -46,7 +45,8 @@ void main() {
// Create and configure the mock BibleXmlParser
final mockBibleXmlParser = MockBibleXmlParser();
when(mockBibleXmlParser.getVerseFromAsset(any, any)).thenAnswer((invocation) async {
when(mockBibleXmlParser.getVerseFromAsset(any, any))
.thenAnswer((invocation) async {
final String reference = invocation.positionalArguments[1];
// Return a mock verse based on the reference for testing purposes
return 'Mock Verse for $reference';
@@ -58,7 +58,8 @@ void main() {
'flutter/assets',
(ByteData? message) async {
final String key = utf8.decode(message!.buffer.asUint8List());
if (key == 'assets/scriptures.json' || key == 'assets/scriptures_optimized.json') {
if (key == 'assets/scriptures.json' ||
key == 'assets/scriptures_optimized.json') {
final json = {
"menstrual": [
{
@@ -120,8 +121,10 @@ void main() {
Hive.init(testPath);
Hive.registerAdapter(ScriptureAdapter()); // Register your adapter
Hive.registerAdapter(BibleTranslationAdapter()); // Register BibleTranslationAdapter
database = ScriptureDatabase(bibleXmlParser: mockBibleXmlParser); // Instantiate with mock
Hive.registerAdapter(
BibleTranslationAdapter()); // Register BibleTranslationAdapter
database = ScriptureDatabase(
bibleXmlParser: mockBibleXmlParser); // Instantiate with mock
await database.loadScriptures();
});
@@ -145,11 +148,11 @@ void main() {
class _MockPathProviderPlatform extends PathProviderPlatform {
@override
Future<String?> getApplicationSupportPath() async {
return Directory.current.path + '/test_hive_temp';
return '${Directory.current.path}/test_hive_temp';
}
@override
Future<String?> getApplicationDocumentsPath() async {
return Directory.current.path + '/test_hive_temp';
return '${Directory.current.path}/test_hive_temp';
}
}