getOrigins method Null safety

Future<List<AndroidWebStorageOrigin>> getOrigins()

Gets the origins currently using either the Application Cache or Web SQL Database APIs.

Implementation

Future<List<AndroidWebStorageOrigin>> getOrigins() async {
  List<AndroidWebStorageOrigin> originsList = [];

  Map<String, dynamic> args = <String, dynamic>{};
  List<Map<dynamic, dynamic>> origins =
      (await _staticChannel.invokeMethod('getOrigins', args))
          .cast<Map<dynamic, dynamic>>();

  for (var origin in origins) {
    originsList.add(AndroidWebStorageOrigin(
        origin: origin["origin"],
        quota: origin["quota"],
        usage: origin["usage"]));
  }

  return originsList;
}