flutter_local_notifications
flutter_local_notifications copied to clipboard
flutter_local_notifications_linux is pulled in on Android
- Run
flutter build apk --analyze-size --target-platform android-arm64 - See
package:flutter_local_notifications_linuxandpackage:dbusincluded in the output
This increases app size.
Example:
✓ Built build/app/outputs/flutter-apk/app-release.apk (7.0MB).
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
app-release.apk (total compressed) 7 MB
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
res/
layout 8 KB
drawable-xhdpi-v4 2 KB
layout-v17 7 KB
drawable-mdpi-v4 2 KB
drawable-anydpi-v21 1 KB
drawable 1 KB
drawable-xxxhdpi-v4 2 KB
mipmap-hdpi-v4 3 KB
drawable-xxhdpi-v4 1 KB
mipmap-mdpi-v4 2 KB
drawable-hdpi-v4 2 KB
layout-v21 2 KB
mipmap-xxhdpi-v4 7 KB
mipmap-xhdpi-v4 4 KB
mipmap-xxxhdpi-v4 10 KB
META-INF/
MANIFEST.MF 4 KB
kotlinx-coroutines-core.kotlin_module 1 KB
CERT.SF 4 KB
kotlin-stdlib.kotlin_module 3 KB
CERT.RSA 2 KB
kotlin/
reflect 1 KB
kotlin.kotlin_builtins 4 KB
collections 1 KB
assets/
org 39 KB
flutter_assets 88 KB
resources.arsc 30 KB
AndroidManifest.xml 3 KB
lib/
arm64-v8a 6 MB
Dart AOT symbols accounted decompressed size 5 MB
package:flutter 3 MB
dart:core 277 KB
package:goguma 225 KB
dart:typed_data 212 KB
dart:ui 178 KB
dart:io 168 KB
package:dbus 158 KB
dart:collection 144 KB
dart:async 127 KB
package:sqflite_common 68 KB
dart:convert 67 KB
package:sqlite3 63 KB
package:sqflite_common_ffi 62 KB
package:vector_math/
vector_math_64.dart 40 KB
package:flutter_local_notifications_linux 38 KB
package:characters 32 KB
package:material_color_utilities 32 KB
package:flutter_typeahead/
src 30 KB
dart:ffi 30 KB
package:flutter_local_notifications 29 KB
classes.dex 557 KB
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
A summary of your APK analysis can be found at: /home/simon/.flutter-devtools/apk-code-size-analysis_02.json
Thanks didn't know about that command. I don't know if it's possible to resolve this one though. If anyone else here knows then contributions are welcome. Linux support itself was a contribution from the community. This may have to do with how the plugin is structured to allow notification details specific to each platform to be configured. I did a search and saw similar issue open that references the same APIs to do platform checks https://github.com/flutter/flutter/issues/14233
Edit: following the trail in the thread, path_provider has a similar issue and it's considered expected behaviour at the moment so if I'm not mistaken, looks like nothing can be done
I wonder whether isolating the type definitions in a separate file in the linux package, and including only that file from the common package would be enough. I'll experiment a bit with that idea.
This approach works fine to avoid including the whole package for type definitions, but we still need to decide which impl to use based on the Platform -- and that can't be done at compile-time sadly.
Indeed, looks like nothing can be done from our side for now, need changes in Dart/Flutter.
Setting the following in pubspec.yaml should help:
flutter:
plugin:
implements: flutter_local_notifications
platforms:
linux:
dartPluginClass: flutter_local_notifications_linux
You can have a look to my repository for examples.