java-james / flutter_dotenv

Loads environment variables from `.env`.
https://pub.dartlang.org/packages/flutter_dotenv
MIT License
219 stars 47 forks source link

Error: Not found: 'dart:ui' export 'dart:ui' show VoidCallback #38

Open fadhlimaulidri opened 3 years ago

fadhlimaulidri commented 3 years ago

flutter version : 2.2.0 flutter_dotenv version : 5.0.0

i use flutter_dotenv for data preparation automation testing use flutter driver. i have use as documentation but i get error like bellow

user@name-MacBook-Pro % flutter drive --target=test_driver/app.dart
Running "flutter pub get" in repository...            1,229ms
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         6.2s
Xcode build done.                                           22.2s
../../flutter/packages/flutter/lib/src/foundation/basic_types.dart:9:1: Error: Not found: 'dart:ui'
export 'dart:ui' show VoidCallback;
^
../../flutter/packages/flutter/lib/src/foundation/binding.dart:8:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show SingletonFlutterWindow, Brightness, PlatformDispatcher, window;
       ^
../../flutter/packages/flutter/lib/src/foundation/debug.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Brightness;
       ^
../../flutter/packages/flutter/lib/src/foundation/key.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show hashValues;
       ^
../../flutter/packages/flutter/lib/src/foundation/stack_frame.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show hashValues;
       ^
../../flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
       ^
../../flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
       ^
../../flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
Failed to stop app

this my code


import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:gherkin/gherkin.dart';
import 'package:matcher/matcher.dart';

StepDefinitionGeneric SellerAccountPreparation() {
  return given<FlutterWorld>(
    'there is seller who have been registered before',
    (context) async {
      var username;
      var password = 'asdasd';

      await dotenv.load(fileName: ".env");

      username = dotenv.env['USERNAME'];

      print("username: " + username);

      print("password: " + password);
    },
  );
}
martin-braun commented 5 months ago

Came to the same conclusion. The driver doesn't run in the Flutter context. I think this package uses dart:ui for Color and whatnot.

You can use its upstream via flutter pub add -d dotenv, this one is for dart and doesn't use Flutter dependencies, so you can use it in the driver safely.