_Platform:_
_IDE:_
_split-debug-info and obfuscate (Flutter Android or iOS) or CanvasKit (Flutter Web):_
_Platform installed with:_
Output of the command flutter doctor -v below:
[鈭歖 Flutter (Channel stable, 2.0.1, on Microsoft Windows [Version 10.0.14393], locale pl-PL)
[鈭歖 Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[鈭歖 Chrome - develop for the web
[鈭歖 Android Studio (version 4.1.0)
[鈭歖 VS Code (version 1.54.3)
[鈭歖 Connected device (1 available)
The output goes here...
The version of the SDK (See pubspec.lock):
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.24.0-7.0"
I have the following issue:
After upgrading some packages in my app as well as Sentry and Sentry_Flutter ( sentry: ^4.0.6, sentry_flutter: ^4.0.6) the User is not recognized as a function or class "The function 'User' isn't defined. Try importing the library that defines 'User', correcting the name to the name of an existing function, or defining a function named 'User'."
In this file I have both : import 'package:sentry/sentry.dart'; import 'package:sentry_flutter/sentry_flutter.dart';
The code I am using it in is:
import 'package:sentry/sentry.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import '../services/device_info.dart';
import '../services/shared_data.dart';
Future<void> initializeSentryUserInfo() async {
await getDeviceDetails();
Sentry.configureScope((scope) {
scope
..user = User(
id: SharedData().userEmail,
email: SharedData().userEmail,
extras: <String, dynamic>{
'email': SharedData().userEmail,
'platform': SharedData().platform,
'androidVersion': SharedData().androidVersion,
'appVersion': SharedData().appVersion,
'deviceName': SharedData().deviceName,
'deviceVersion': SharedData().deviceVersion,
},
);
});
}
Expected result:
Thanks!
Stupid me User is now SentryUser. Took me some time to figure out. Please check the documentation on the package page - here is what it says:
Sentry.configureScope((scope) {
scope
..user = User(
id: '800',
username: 'first-user',
email: '[email protected]',
ipAddress: '127.0.0.1',
extras: <String, String>{'first-sign-in': '2020-01-01'},
)
..fingerprint = ['example-dart']
..transaction = '/example/app'
..level = SentryLevel.warning
..setTag('build', '579')
..setExtra('company-name', 'Dart Inc');
});
Thanks for letting us know. Seems like I missed some places where I needed to update the docs 鈽癸笍
Do you mind linking the page where you found that code sample?
@ueman your doc changes are not merged yet, we only do once is GA (stable) version, for pre-releases, people can follow the github changelog that usually has a breaking change section and a how-to migrate it.
Stupid me User is now SentryUser. Took me some time to figure out. Please check the documentation on the package page - here is what it says:
Sentry.configureScope((scope) { scope ..user = User( id: '800', username: 'first-user', email: '[email protected]', ipAddress: '127.0.0.1', extras: <String, String>{'first-sign-in': '2020-01-01'}, ) ..fingerprint = ['example-dart'] ..transaction = '/example/app' ..level = SentryLevel.warning ..setTag('build', '579') ..setExtra('company-name', 'Dart Inc'); });
https://github.com/getsentry/sentry-dart/releases/tag/4.1.0-nullsafety.1 see breaking changes section.
Yeah I know, but I don't recognize the code sample he or she has pasted. So I still think it's something I missed.
This is where the code is from:
https://pub.dev/packages/sentry/example
Most helpful comment
This is where the code is from:
https://pub.dev/packages/sentry/example