@@ -164,7 +164,8 @@ class SentryClient {
164164 '${dsnUri .scheme }://${dsnUri .host }/api/$projectId /store/' ;
165165
166166 /// Reports an [event] to Sentry.io.
167- Future <SentryResponse > capture ({@required Event event}) async {
167+ Future <SentryResponse > capture (
168+ {@required Event event, StackFrameFilter stackFrameFilter}) async {
168169 final DateTime now = _clock ();
169170 String authHeader = 'Sentry sentry_version=6, sentry_client=$sentryClient , '
170171 'sentry_timestamp=${now .millisecondsSinceEpoch }, sentry_key=$publicKey ' ;
@@ -192,7 +193,8 @@ class SentryClient {
192193 if (userContext != null ) {
193194 mergeAttributes ({'user' : userContext.toJson ()}, into: data);
194195 }
195- mergeAttributes (event.toJson (), into: data);
196+ mergeAttributes (event.toJson (stackFrameFilter: stackFrameFilter),
197+ into: data);
196198
197199 List <int > body = utf8.encode (json.encode (data));
198200 if (compressPayload) {
@@ -216,15 +218,19 @@ class SentryClient {
216218 }
217219
218220 /// Reports the [exception] and optionally its [stackTrace] to Sentry.io.
221+ ///
222+ /// Optionally allows specifying a [stackFrameFilter] that receives the
223+ /// list of stack frames just before sending to allow modifying it.
219224 Future <SentryResponse > captureException ({
220225 @required dynamic exception,
221226 dynamic stackTrace,
227+ StackFrameFilter stackFrameFilter,
222228 }) {
223229 final Event event = new Event (
224230 exception: exception,
225231 stackTrace: stackTrace,
226232 );
227- return capture (event: event);
233+ return capture (event: event, stackFrameFilter : stackFrameFilter );
228234 }
229235
230236 Future <Null > close () async {
@@ -376,7 +382,7 @@ class Event {
376382 final List <String > fingerprint;
377383
378384 /// Serializes this event to JSON.
379- Map <String , dynamic > toJson () {
385+ Map <String , dynamic > toJson ({ StackFrameFilter stackFrameFilter} ) {
380386 final Map <String , dynamic > json = < String , dynamic > {
381387 'platform' : sdkPlatform,
382388 'sdk' : {
@@ -406,7 +412,8 @@ class Event {
406412
407413 if (stackTrace != null ) {
408414 json['stacktrace' ] = < String , dynamic > {
409- 'frames' : encodeStackTrace (stackTrace),
415+ 'frames' :
416+ encodeStackTrace (stackTrace, stackFrameFilter: stackFrameFilter),
410417 };
411418 }
412419
0 commit comments