fluttercommunity / flutter_sms

A Flutter plugin to Send SMS and MMS on iOS and Android. If iMessage is enabled it will send as iMessage on iOS. This plugin must be tested on a real device on iOS. Maintainer: @rodydavis
https://fluttercommunity.github.io/flutter_sms/
MIT License
246 stars 191 forks source link

TypeError: Cannot read property 'PictureRecorder' of undefined #44

Open davidpanic opened 3 years ago

davidpanic commented 3 years ago

This happens if you just add the package to your pubspec (you don't even have to use it) and run for flutter web. This does not prevent the app for starting, but it is polluting our sentry instance with weird errors.

If you want to reproduce it just create a new app and add flutter_sms: ^2.3.1 to your pubspec, then do flutter run -d chrome.

I think you should just return false in canSendSMS() instead of throwing this monster.

TypeError: Cannot read property 'PictureRecorder' of undefined
    at _engine.CkPictureRecorder.new.beginRecording (http://localhost:36985/dart_sdk.js:135664:82)
    at Function.new (http://localhost:36985/dart_sdk.js:130810:56)
    at Function.new (http://localhost:36985/dart_sdk.js:122055:43)
    at DefaultShaderWarmUp.execute (http://localhost:36985/packages/flutter/src/painting/shader_warm_up.dart.lib.js:115:35)
    at execute.next (<anonymous>)
    at runBody (http://localhost:36985/dart_sdk.js:37228:34)
    at Object._async [as async] (http://localhost:36985/dart_sdk.js:37259:7)
    at DefaultShaderWarmUp.execute (http://localhost:36985/packages/flutter/src/painting/shader_warm_up.dart.lib.js:113:20)
    at binding$5.WidgetsFlutterBinding.new.initInstances (http://localhost:36985/packages/flutter/src/painting/binding.dart.lib.js:75:30)
    at binding$5.WidgetsFlutterBinding.new.initInstances (http://localhost:36985/packages/flutter/src/semantics/binding.dart.lib.js:41:13)
    at binding$5.WidgetsFlutterBinding.new.initInstances (http://localhost:36985/packages/flutter/src/rendering/layer.dart.lib.js:5918:13)
    at binding$5.WidgetsFlutterBinding.new.initInstances (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:50901:13)
    at binding$5.WidgetsFlutterBinding.new.binding.BindingBase.new (http://localhost:36985/packages/flutter/src/foundation/binding.dart.lib.js:371:10)
    at binding$5.WidgetsFlutterBinding.new.BindingBase_GestureBinding$36.new (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51478:49)
    at binding$5.WidgetsFlutterBinding.new.BindingBase_SchedulerBinding$36.new (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51484:51)
    at binding$5.WidgetsFlutterBinding.new.BindingBase_ServicesBinding$36.new (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51490:50)
    at binding$5.WidgetsFlutterBinding.new.BindingBase_PaintingBinding$36.new (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51496:50)
    at binding$5.WidgetsFlutterBinding.new.BindingBase_SemanticsBinding$36.new (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51502:51)
    at binding$5.WidgetsFlutterBinding.new.BindingBase_RendererBinding$36.new (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51508:50)
    at binding$5.WidgetsFlutterBinding.new.BindingBase_WidgetsBinding$36.new (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51514:49)
    at new binding$5.WidgetsFlutterBinding.new (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51524:51)
    at Function.ensureInitialized (http://localhost:36985/packages/flutter/src/widgets/widget_span.dart.lib.js:51519:54)
    at Function.registerWith (http://localhost:36985/packages/flutter_sms/flutter_sms_web.dart.lib.js:34:37)
    at Object.registerPlugins (http://localhost:36985/packages/flutter_ck_picture_recorder/generated_plugin_registrant.dart.lib.js:31:38)
    at main (http://localhost:36985/web_entrypoint.dart.lib.js:41:35)
    at main.next (<anonymous>)
    at runBody (http://localhost:36985/dart_sdk.js:37228:34)
    at Object._async [as async] (http://localhost:36985/dart_sdk.js:37259:7)
    at main$ (http://localhost:36985/web_entrypoint.dart.lib.js:40:18)
    at http://localhost:36985/main_module.bootstrap.js:19:10
    at Array.forEach (<anonymous>)
    at window.$dartRunMain (http://localhost:36985/main_module.bootstrap.js:18:32)
    at <anonymous>:1:8
    at Object.runMain (http://localhost:36985/dwds/src/injected/client.js:8656:21)
    at http://localhost:36985/dwds/src/injected/client.js:22068:19
    at _wrapJsFunctionForAsync_closure.$protected (http://localhost:36985/dwds/src/injected/client.js:3830:15)
    at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:36985/dwds/src/injected/client.js:10905:12)
    at Object._asyncStartSync (http://localhost:36985/dwds/src/injected/client.js:3794:20)
    at main__closure1.$call$body$main__closure (http://localhost:36985/dwds/src/injected/client.js:22080:16)
    at main__closure1.call$1 (http://localhost:36985/dwds/src/injected/client.js:22007:19)
    at StaticClosure._rootRunUnary [as call$2$5] (http://localhost:36985/dwds/src/injected/client.js:4153:16)
    at _CustomZone.runUnary$2$2 (http://localhost:36985/dwds/src/injected/client.js:12136:39)
    at _CustomZone.runUnaryGuarded$1$2 (http://localhost:36985/dwds/src/injected/client.js:12068:14)
    at _ControllerSubscription._sendData$1 (http://localhost:36985/dwds/src/injected/client.js:11697:19)
    at _DelayedData.perform$1 (http://localhost:36985/dwds/src/injected/client.js:11849:59)
    at _PendingEvents_schedule_closure.call$0 (http://localhost:36985/dwds/src/injected/client.js:11898:14)
    at Object._microtaskLoop (http://localhost:36985/dwds/src/injected/client.js:3990:24)
    at StaticClosure._startMicrotaskLoop (http://localhost:36985/dwds/src/injected/client.js:3996:11)
    at _AsyncRun__initializeScheduleImmediate_internalCallback.call$1 (http://localhost:36985/dwds/src/injected/client.js:10774:9)
    at invokeClosure (http://localhost:36985/dwds/src/injected/client.js:1250:26)
    at MutationObserver.<anonymous> (http://localhost:36985/dwds/src/injected/client.js:1269:18)
CripyIce commented 3 years ago

Same here.. any news?

lirantzairi commented 2 years ago

Same here, please update

cybertheory commented 2 years ago

I have the same issue, bumping

AliRezaBeitari commented 2 years ago

I have the same issue!

AliRezaBeitari commented 2 years ago

I fixed the issue in https://github.com/fluttercommunity/flutter_sms/pull/55