2

When using

to access Google Api's thru Flutter using this code

import 'dart:convert';
import 'dart:io';

import 'package:googleapis_auth/auth.dart';
import 'package:googleapis_auth/auth_browser.dart';
import 'package:googleapis_auth/auth_io.dart';
import 'package:googleapis/androidpublisher/v3.dart';

Future main() async {
  dynamic jsonData = json.decode(
      await File('api-xxxxxxxxxxxxxxxxxxxx.json')
          .readAsString());
  var scopes = [AndroidpublisherApi.AndroidpublisherScope];
  final accountCredentials = new ServiceAccountCredentials.fromJson(jsonData);

  AuthClient client = await clientViaServiceAccount(accountCredentials, scopes);


}

you will get this error

Error: Not found: 'dart:html' import 'dart:html' as html;

Mohamed Elrashid
  • 8,125
  • 6
  • 31
  • 46

1 Answers1

9

Base on FAQ - Flutter :

Can Flutter run any Dart code?

Flutter should be able to run most Dart code that does not import (transitively, or directly) dart:mirrors or dart:html.


Problem synonym and analysis :

  • Look like you are using a package

  • which depends on 'dart:html'

  • which is not supported in Flutter

Solution :

  • remove

    import 'package:googleapis_auth/auth_browser.dart';
    
Mohamed Elrashid
  • 8,125
  • 6
  • 31
  • 46