class GirisSayfasi extends StatefulWidget {
@override
_GirisSayfasiState createState() => _GirisSayfasiState();
}
class _GirisSayfasiState extends State<GirisSayfasi>{
GirisSonucApiViewModel _girisSonucApiViewModel;
..............
........
@override
Widget build(BuildContext context) {
_girisSonucApiViewModel = Provider.of<GirisSonucApiViewModel>(context);
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text("Login"),
elevation: 3,
),
body: Stack(
fit: StackFit.expand,
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/blu.jpg"),
fit: BoxFit.cover),
),
...................
════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════
The following assertion was thrown while handling a gesture:
Tried to listen to a value exposed with provider, from outside of the widget tree.
This is likely caused by an event handler (like a button's onPressed) that called
Provider.of without passing `listen: false`.
To fix, write:
Provider.of<GirisSonucApiViewModel>(context, listen: false);
It is unsupported because may pointlessly rebuild the widget associated to the
event handler, when the widget tree doesn't care about the value.
The context used was: GirisSayfasi(state: _GirisSayfasiState#0d424)
'package:provider/src/provider.dart':
Failed assertion: line 191 pos 7: 'context.owner.debugBuilding ||
listen == false ||
debugIsInInheritedProviderUpdate'
When the exception was thrown, this was the stack:
#2 Provider.of (package:provider/src/provider.dart:191:7)
#3 _GirisSayfasiState.build.<anonymous closure> (package:flutterbizebildirprovider/widget/giris.dart:180:66)
#4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)
#5 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:862:36)
#6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
...
Handler: "onTap"
Recognizer: TapGestureRecognizer#ed663
debugOwner: GestureDetector
state: possible
won arena
finalPosition: Offset(219.8, 441.1)
finalLocalPosition: Offset(89.1, 22.1)
button: 1
sent tap down
════════════════════════════════════════════════════════════════════════════════════════════════════
Hello,
I am trying to use the provider in the Statefull widget and this way I get an error. I want to call and use the function via viewModel, but currently I am unable to progress due to this error. I would be very glad if you could help.
Best regards
--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/ac5594c7-b8c9-40a1-8721-97ab95224e24o%40googlegroups.com.