First I hooked up hooks_riverpod which didn't recognize useEffect, then I hooked up flutter_hooks and it threw an error: Method not found: 'SearchController'.
Error: .../Pub/Cache/hosted/pub.dev/flutter_hooks-0.20.0/lib/src/search_controller.dart:21:22: Error: Method not found: 'SearchController'. final controller = SearchController();
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:riverpod_firebase_register_crud_app/ui/utils/lables.dart';
import '../root.dart';
class SplashPage extends HookWidget {
const SplashPage({super.key});
static const String route = '/splash';
void startController() async {
await Future.delayed(const Duration(seconds: 1));
}
@override
Widget build(BuildContext context) {
useEffect(() {
startController();
if (Navigator.canPop(context)) {
Navigator.pushNamedAndRemoveUntil(
context,
Root.route,
(route) => false,
);
}
return null; // Returning null to indicate no cleanup is needed
}, const []);
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.favorite,
size: 80,
),
const SizedBox(
height: 24,
),
Text(
Labels.appName,
style: Theme.of(context).textTheme.headlineLarge!.copyWith(
color: Theme.of(context).colorScheme.onPrimaryContainer),
),
],
),
),
);
}
}
To temporarily work around this issue, you can comment out search_controller.dart in flutter_hooks>lib>src>hooks.dart
Not the best solution though Downgrade works
Use this for now: flutter_hooks: ^0.18.6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With