@@ -26,6 +26,10 @@ class Sentry {
2626 Sentry ._();
2727
2828 /// Returns the current hub
29+ @Deprecated (
30+ 'This is scheduled to be removed in Sentry v6.0.0. '
31+ 'Instead of currentHub you should use Sentry\' s static methods.' ,
32+ )
2933 static Hub get currentHub => _hub;
3034
3135 /// Initializes the SDK
@@ -98,7 +102,7 @@ class Sentry {
98102
99103 // let's set the default values to options
100104 if (await _setDefaultConfiguration (options)) {
101- final hub = currentHub ;
105+ final hub = _hub ;
102106 _hub = Hub (options);
103107 await hub.close ();
104108 }
@@ -138,15 +142,15 @@ class Sentry {
138142 dynamic stackTrace,
139143 dynamic hint,
140144 }) async =>
141- currentHub .captureEvent (event, stackTrace: stackTrace, hint: hint);
145+ _hub .captureEvent (event, stackTrace: stackTrace, hint: hint);
142146
143147 /// Reports the [throwable] and optionally its [stackTrace] to Sentry.io.
144148 static Future <SentryId > captureException (
145149 dynamic throwable, {
146150 dynamic stackTrace,
147151 dynamic hint,
148152 }) async =>
149- currentHub .captureException (
153+ _hub .captureException (
150154 throwable,
151155 stackTrace: stackTrace,
152156 hint: hint,
@@ -159,7 +163,7 @@ class Sentry {
159163 List <dynamic >? params,
160164 dynamic hint,
161165 }) async =>
162- currentHub .captureMessage (
166+ _hub .captureMessage (
163167 message,
164168 level: level,
165169 template: template,
@@ -169,30 +173,30 @@ class Sentry {
169173
170174 /// Close the client SDK
171175 static Future <void > close () async {
172- final hub = currentHub ;
176+ final hub = _hub ;
173177 _hub = NoOpHub ();
174178 await hub.close ();
175179 }
176180
177181 /// Check if the current Hub is enabled/active.
178- static bool get isEnabled => currentHub .isEnabled;
182+ static bool get isEnabled => _hub .isEnabled;
179183
180184 /// Last event id recorded by the current Hub
181- static SentryId get lastEventId => currentHub .lastEventId;
185+ static SentryId get lastEventId => _hub .lastEventId;
182186
183187 /// Adds a breacrumb to the current Scope
184188 static void addBreadcrumb (Breadcrumb crumb, {dynamic hint}) =>
185- currentHub .addBreadcrumb (crumb, hint: hint);
189+ _hub .addBreadcrumb (crumb, hint: hint);
186190
187191 /// Configures the scope through the callback.
188192 static void configureScope (ScopeCallback callback) =>
189- currentHub .configureScope (callback);
193+ _hub .configureScope (callback);
190194
191195 /// Clones the current Hub
192- static Hub clone () => currentHub .clone ();
196+ static Hub clone () => _hub .clone ();
193197
194198 /// Binds a different client to the current hub
195- static void bindClient (SentryClient client) => currentHub .bindClient (client);
199+ static void bindClient (SentryClient client) => _hub .bindClient (client);
196200
197201 static Future <bool > _setDefaultConfiguration (SentryOptions options) async {
198202 // if the DSN is empty, let's disable the SDK
0 commit comments