Skip to content

deviceInfoPlugin.androidInfo.version.toString() does not return a useful string #3712

@ooglek

Description

@ooglek

I'm getting the value of Instance of 'AndroidBuildVersion' when I call deviceInfoPlugin.androidInfo.version.toString()

The documentation seems to imply that I might get something useful out of version.toString()

https://pub.dev/documentation/device_info_plus/latest/device_info_plus/AndroidBuildVersion-class.html

I realize the Object class just inherits the default behavior of toString() and just outputs the standard instance.

I think an override here would be quite useful.

This is what I'll be implementing in my code... it'd be useful for Android IMHO! :-)

@override
String toString() {
  var output = '';
  if (![null, ''].contains(baseOS)) {
    output += baseOS;
  }
  output += release;
  if (![null, ''].contains(securityPatch)) {
	output += ' ' + securityPatch;
  }
  output += ' ($sdkInt, $incremental)';
  return output;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions