fromPlatform method

  1. @override
Future<BuildInfoData> fromPlatform()
override

Get BuildInfoData from the platform.

Implementation

@override
Future<BuildInfoData> fromPlatform() async {
  final map =
      await methodChannel.invokeMapMethod<String, dynamic>('fromPlatform');

  int? buildDate, installDate;

  if (map?.containsKey('buildDate') == true && map?['buildDate'] is int) {
    buildDate = map!['buildDate'];
  }

  if (map?.containsKey('installDate') == true && map?['installDate'] is int) {
    installDate = map!['installDate'];
  }

  return BuildInfoData.fromMillisecondsSinceEpoch(
    buildDate: buildDate,
    installDate: installDate,
  );
}