improved error reporting + package upgrade + minor fixes

This commit is contained in:
Thibault Deckers 2021-09-04 20:03:13 +09:00
parent c29b307cef
commit 77e5e950ef
7 changed files with 62 additions and 35 deletions

View file

@ -68,15 +68,19 @@ class DebugHandler(private val context: Context) : MethodCallHandler {
return return
} }
if (!isSupportedByPixyMeta(mimeType)) {
result.error("getPixyMetadata-unsupported", "PixyMeta does not support mimeType=$mimeType", null)
return
}
val metadataMap = HashMap<String, String>() val metadataMap = HashMap<String, String>()
if (isSupportedByPixyMeta(mimeType)) { try {
try { StorageUtils.openInputStream(context, uri)?.use { input ->
StorageUtils.openInputStream(context, uri)?.use { input -> metadataMap.putAll(PixyMetaHelper.describe(input))
metadataMap.putAll(PixyMetaHelper.describe(input))
}
} catch (e: Exception) {
result.error("getPixyMetadata-exception", e.message, e.stackTraceToString())
} }
} catch (e: Exception) {
result.error("getPixyMetadata-exception", e.message, e.stackTraceToString())
return
} }
result.success(metadataMap) result.success(metadataMap)
} }

View file

@ -47,6 +47,7 @@ class MimeTypes {
static const mp2t = 'video/mp2t'; // .m2ts static const mp2t = 'video/mp2t'; // .m2ts
static const mp4 = 'video/mp4'; static const mp4 = 'video/mp4';
static const ogg = 'video/ogg'; static const ogg = 'video/ogg';
static const webm = 'video/webm';
static const json = 'application/json'; static const json = 'application/json';
@ -62,7 +63,7 @@ class MimeTypes {
static const Set<String> _knownOpaqueImages = {heic, heif, jpeg}; static const Set<String> _knownOpaqueImages = {heic, heif, jpeg};
static const Set<String> _knownVideos = {avi, aviVnd, mkv, mov, mp2t, mp4, ogg}; static const Set<String> _knownVideos = {avi, aviVnd, mkv, mov, mp2t, mp4, ogg, webm};
static final Set<String> knownMediaTypes = {..._knownOpaqueImages, ...alphaImages, ...rawImages, ...undecodableImages, ..._knownVideos}; static final Set<String> knownMediaTypes = {..._knownOpaqueImages, ...alphaImages, ...rawImages, ...undecodableImages, ..._knownVideos};

View file

@ -1,5 +1,8 @@
import 'package:collection/collection.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:stack_trace/stack_trace.dart';
abstract class ReportService { abstract class ReportService {
bool get isCollectionEnabled; bool get isCollectionEnabled;
@ -40,6 +43,19 @@ class CrashlyticsReportService extends ReportService {
@override @override
Future<void> recordError(dynamic exception, StackTrace? stack) { Future<void> recordError(dynamic exception, StackTrace? stack) {
if (exception is PlatformException && stack != null) {
// simply creating a trace with `Trace.current(1)` or creating a `Trace` from modified frames
// does not yield a stack trace that Crashlytics can segment,
// so we reconstruct a string stack trace instead
stack = StackTrace.fromString(Trace.from(stack)
.frames
.skip(2)
.toList()
.mapIndexed(
(i, f) => '#${(i++).toString().padRight(8)}${f.member} (${f.uri}:${f.line}:${f.column})',
)
.join('\n'));
}
return instance.recordError(exception, stack); return instance.recordError(exception, stack);
} }

View file

@ -289,15 +289,20 @@ class Constants {
license: 'Apache 2.0', license: 'Apache 2.0',
sourceUrl: 'https://github.com/DavBfr/dart_pdf', sourceUrl: 'https://github.com/DavBfr/dart_pdf',
), ),
Dependency(
name: 'Stack Trace',
license: 'BSD 3-Clause',
sourceUrl: 'https://github.com/dart-lang/stack_trace',
),
Dependency( Dependency(
name: 'Transparent Image', name: 'Transparent Image',
license: 'MIT', license: 'MIT',
sourceUrl: 'https://pub.dev/packages/transparent_image', sourceUrl: 'https://github.com/brianegan/transparent_image',
), ),
Dependency( Dependency(
name: 'Tuple', name: 'Tuple',
license: 'BSD 2-Clause', license: 'BSD 2-Clause',
sourceUrl: 'https://github.com/dart-lang/tuple', sourceUrl: 'https://github.com/google/tuple.dart',
), ),
Dependency( Dependency(
name: 'Version', name: 'Version',

View file

@ -105,7 +105,7 @@ packages:
name: connectivity_plus name: connectivity_plus
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.7" version: "1.1.0"
connectivity_plus_linux: connectivity_plus_linux:
dependency: transitive dependency: transitive
description: description:
@ -119,7 +119,7 @@ packages:
name: connectivity_plus_macos name: connectivity_plus_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.1.0"
connectivity_plus_platform_interface: connectivity_plus_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -133,14 +133,14 @@ packages:
name: connectivity_plus_web name: connectivity_plus_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0+1"
connectivity_plus_windows: connectivity_plus_windows:
dependency: transitive dependency: transitive
description: description:
name: connectivity_plus_windows name: connectivity_plus_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.1.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
@ -232,7 +232,7 @@ packages:
description: description:
path: "." path: "."
ref: aves ref: aves
resolved-ref: "9542ec208248bfa4d459e3967087a4b236da1368" resolved-ref: "2aefcebb9f4bc08107e7de16927d91e577e10d7d"
url: "git://github.com/deckerst/fijkplayer.git" url: "git://github.com/deckerst/fijkplayer.git"
source: git source: git
version: "0.10.0" version: "0.10.0"
@ -249,7 +249,7 @@ packages:
name: firebase_core name: firebase_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.0" version: "1.6.0"
firebase_core_platform_interface: firebase_core_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -270,14 +270,14 @@ packages:
name: firebase_crashlytics name: firebase_crashlytics
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.0" version: "2.2.1"
firebase_crashlytics_platform_interface: firebase_crashlytics_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: firebase_crashlytics_platform_interface name: firebase_crashlytics_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.1" version: "3.1.2"
flex_color_picker: flex_color_picker:
dependency: "direct main" dependency: "direct main"
description: description:
@ -341,14 +341,14 @@ packages:
name: flutter_markdown name: flutter_markdown
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.4" version: "0.6.6"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:
name: flutter_plugin_android_lifecycle name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.3"
flutter_staggered_animations: flutter_staggered_animations:
dependency: "direct main" dependency: "direct main"
description: description:
@ -405,7 +405,7 @@ packages:
name: google_maps_flutter name: google_maps_flutter
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.6" version: "2.0.8"
google_maps_flutter_platform_interface: google_maps_flutter_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -594,7 +594,7 @@ packages:
name: package_info_plus name: package_info_plus
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.5" version: "1.0.6"
package_info_plus_linux: package_info_plus_linux:
dependency: transitive dependency: transitive
description: description:
@ -622,7 +622,7 @@ packages:
name: package_info_plus_web name: package_info_plus_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "1.0.4"
package_info_plus_windows: package_info_plus_windows:
dependency: transitive dependency: transitive
description: description:
@ -636,7 +636,7 @@ packages:
name: palette_generator name: palette_generator
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.1"
panorama: panorama:
dependency: "direct main" dependency: "direct main"
description: description:
@ -685,7 +685,7 @@ packages:
name: pdf name: pdf
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.4.2" version: "3.5.0"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
@ -804,7 +804,7 @@ packages:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.6" version: "2.0.7"
shared_preferences_linux: shared_preferences_linux:
dependency: transitive dependency: transitive
description: description:
@ -832,7 +832,7 @@ packages:
name: shared_preferences_web name: shared_preferences_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.2"
shared_preferences_windows: shared_preferences_windows:
dependency: transitive dependency: transitive
description: description:
@ -900,16 +900,16 @@ packages:
name: sqflite name: sqflite
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0+3" version: "2.0.0+4"
sqflite_common: sqflite_common:
dependency: transitive dependency: transitive
description: description:
name: sqflite_common name: sqflite_common
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0+2" version: "2.0.1"
stack_trace: stack_trace:
dependency: transitive dependency: "direct main"
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
@ -1021,21 +1021,21 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.9" version: "6.0.10"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_linux name: url_launcher_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.2"
url_launcher_macos: url_launcher_macos:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_macos name: url_launcher_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.2"
url_launcher_platform_interface: url_launcher_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -1049,7 +1049,7 @@ packages:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.4"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
@ -1112,7 +1112,7 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.5" version: "2.2.8"
wkt_parser: wkt_parser:
dependency: transitive dependency: transitive
description: description:

View file

@ -56,6 +56,7 @@ dependencies:
provider: provider:
shared_preferences: shared_preferences:
sqflite: sqflite:
stack_trace:
streams_channel: streams_channel:
git: git:
url: git://github.com/deckerst/aves_streams_channel.git url: git://github.com/deckerst/aves_streams_channel.git