Home > other >  Awesome Notifications V0.7.3 on flutter fails to build
Awesome Notifications V0.7.3 on flutter fails to build

Time:12-29

I added the awesome notifications package to my flutter project and initialized it in the main.dart file but when I try to build the app I get this error: `

Launching lib\main.dart on Android SDK built for x86 in debug mode...
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_notifications-0.7.3/lib/src/utils/resource_image_provider.dart:40:26: Error: Type 'DecoderBufferCallback' not found.
      ResourceImage key, DecoderBufferCallback decode) {
                         ^^^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_notifications-0.7.3/lib/src/utils/resource_image_provider.dart:48:26: Error: Type 'DecoderBufferCallback' not found.
      ResourceImage key, DecoderBufferCallback decode) async {
                         ^^^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_notifications-0.7.3/lib/awesome_notifications_method_channel.dart:186:10: Error: Type 'Uint8List' not found.
  Future<Uint8List?> getDrawableData(String drawablePath) async {
         ^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_notifications-0.7.3/lib/src/utils/resource_image_provider.dart:21:7: Error: The non-abstract class 'ResourceImage' is missing implementations for these members:
 - ImageProvider.load
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.
class ResourceImage extends ImageProvider<ResourceImage> {
      ^^^^^^^^^^^^^
/E:/flutter/packages/flutter/lib/src/painting/image_provider.dart:584:24: Context: 'ImageProvider.load' is defined here.
  ImageStreamCompleter load(T key, DecoderCallback decode);
                       ^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_notifications-0.7.3/lib/src/utils/resource_image_provider.dart:40:26: Error: 'DecoderBufferCallback' isn't a type.
      ResourceImage key, DecoderBufferCallback decode) {
                         ^^^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_notifications-0.7.3/lib/src/utils/resource_image_provider.dart:48:26: Error: 'DecoderBufferCallback' isn't a type.
      ResourceImage key, DecoderBufferCallback decode) async {
                         ^^^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_notifications-0.7.3/lib/src/utils/resource_image_provider.dart:50:5: Error: 'Uint8List' isn't a type.
    Uint8List? bytes =

    ^^^^^^^^^

FAILURE: Build failed with an exception.

* Where:
Script 'E:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'E:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 8s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

`

I tried to reinstall the package multiple times but it didn't change anything

CodePudding user response:

You need to update your flutter version:

flutter upgrade

Or downgrade awesome_notifications to older version.

https://pub.dev/packages/awesome_notifications#common-known-issues

Issue: DecoderBufferCallback not found / Uint8List not found

Fix: You need to update your Flutter version running flutter upgrade. These methods was added/deprecated sice version 2.12.

  • Related