You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
child:RaisedButton(
onPressed: () {
// Validate returns true if the form is valid, or false// otherwise.if (_formKey.currentState.validate()) {
print("the search query is "+ myController.text);
// Send data for tracking to Google Tag
gtm.push({'searchTerm': myController.text});
gtm.pushEvent('button1-click');
gtm.pushEvent('button2-click', data: {'value': myController.text});
// Navigate to the results screen.Navigator.of(context).push(MaterialPageRoute(builder: (_) =>SearchResults(myController.text)));
}
},
Now it throws an error when the button is pressed:
════════ Exception caught by gesture ═══════════════════════════════════════════
The following JSNoSuchMethodError was thrown while handling a gesture:
TypeError: Cannot read property 'push' of undefined
When the exception was thrown, this was the stack
packages/google_tag_manager/src/google_tag_manager_base.dart 11:3 push
packages/nationaalarchiefinkleur/components/search_form.dart 65:21 <fn>
packages/flutter/src/material/ink_well.dart 989:21 [_handleTap]
packages/flutter/src/gestures/recognizer.dart 182:24 invokeCallback
packages/flutter/src/gestures/tap.dart 607:48 handleTapUp
...
Handler: "onTap"
I made no changes to the code. I simply build my web app again (using a later version of flutter; 1.25.0-8.1-pre, stable channel)
When I comment out the gtm code, Navigator works as expected.
To solve i tried to upgrade gtm package from 0.0.3 -> 0.1.0. It did not help.
The text was updated successfully, but these errors were encountered:
Is there a solution to this problem? I see this thread was created in 2021 and there is no response from the publisher of this package.
OR is there any other package available to handle GTM on Flutter Web?
This code used to work:
Now it throws an error when the button is pressed:
I made no changes to the code. I simply build my web app again (using a later version of flutter; 1.25.0-8.1-pre, stable channel)
When I comment out the gtm code, Navigator works as expected.
To solve i tried to upgrade gtm package from 0.0.3 -> 0.1.0. It did not help.
The text was updated successfully, but these errors were encountered: