Closed Eng-MohamedGadala closed 4 years ago
The new sintax is:
@override
Future<void> onClose() {
SystemChannels.textInput.invokeMethod('TextInput.hide');
return super.onClose();
}
I will change "Future" by FutureOr to prevent sintaxes errors. Thanks @eduardoflorence !
`class LoginController extends GetxController {
AuthProvider authProvider = AuthProvider();
final RegExp p1 = RegExp(regex.passwordEasy);
String userName;
String password;
bool isUserVerivid;
bool isUserLogin;
bool isFormValid;
String qrCode;
// List
@override
Future
@jonataslaw @eduardoflorence I'm pretty sure that future is not the return yet.
Edit: oh, there's the latest tagged version DisposableInterface
with FutureOr, but I don't get any warnings about that in my code using latest version 🤔
And void is still accepted (if you're refering to my PR on type analyzer stuff I've used FutureOR, so void is acceptable)
@Eng-MohamedGadala try using this: (and be sure that the super.onClose();
is always the latest call):
@override
void onClose() {
SystemChannels.textInput.invokeMethod('TextInput.hide');
super.onClose();
}
Do you still get errors with the above signature?
Thanks but still not working if I change Future to FutureOR only error hide from super.onClose(); but still on onClose()
@Eng-MohamedGadala which message is reported to you when you hover your mouse at those red lines?
oh, unless I looked at the wrong version:
@override
void onClose() async {
SystemChannels.textInput.invokeMethod('TextInput.hide');
super.onClose();
}
hopefully solves it
@Grohden when hold on super.onClose();
package:get/src/state_manager/simple/get_state.dart
Called before [onDelete] method. [onClose] might be used to dispose resources used by the controller. Like closing events, or streams before the controller is destroyed. Or dispose objects that can potentially create some memory leaks, like TextEditingControllers, AnimationControllers. Might be useful as well to persist some data on disk.
Copied from DisposableInterface.
The expression doesn't evaluate to a function, so it can't be invoked.dartinvocation_of_non_function_expression
No changes after using this
@override
void onClose() async {
SystemChannels.textInput.invokeMethod('TextInput.hide');
super.onClose();
}
🤔 maybe a cache on dart analyzer? @eduardoflorence and @jonataslaw are right about 3.8.0 having only future (I couldn't find the 3.8.0 tag on the repo)
Future onClose()
is the right signature
import 'package:flutter/services.dart';
import 'package:get/state_manager.dart';
class LoginController extends GetxController {
@override
Future onClose() {
SystemChannels.textInput.invokeMethod('TextInput.hide');
return super.onClose();
}
}
Is accepted at my project using exactly 3.8.0 on AS. So I don't have any clue about why your analyzer is reporting errors.
You could try restarting it (if you don't know how, restarting vscode will probably restart the analysis server)
I did everything but not working the only working if I change get version to 3.4.6
tested in android studio with latest update get: "3.8.0"
Could be the editor config ?
After using this part of the code no error but not working, onClose not calling any time.
@override
Future get onClose async {
SystemChannels.textInput.invokeMethod('TextInput.hide');
return super.onClose;
}
After using this part of the code show error and not working. on the android studio on the same project but after creating new project and add the same version on get: ^3.8.0
@override
Future onClose() {
SystemChannels.textInput.invokeMethod('TextInput.hide');
return super.onClose();
}
THIS IS MAGIC FOR ME after opening GetXController, I Found the reason like the image I add the same get:^3.8.0 in both project's but get_state.dart file not the same content and version old project 3.8.0 but new project 3.10.1 I don't now reason but that happened
Thank's for everyone to try to help me.
As I couldn't reproduce this in the last version, I'm closing it. If you face problems, you can open another issue, or use the platform channels to ask for quick help
Describe the bug @override onClose{ SystemChannels.textInput.invokeMethod('TextInput.hide'); } not working after upgrade to get: ^3.8.0
Flutter Version: Flutter 1.21.0-9.2.pre • channel beta
Getx Version: get: ^3.8.0
Minimal reproduce code @override onClose{ SystemChannels.textInput.invokeMethod('TextInput.hide'); }