flutter timezone adding database with terminal not working

Viewed 118

I'm using time zone in my project and I was trying to download the database using this command flutter pub run tool/get -s 2021d. I've redirected from external libraries and run this command from C:\flutter\.pub-cache\hosted\pub.dartlang.org\timezone-0.8.0>.

but when I run Failed to precompile timezone:get: Error: Error when reading '../../../global_packages/timezone/.dart_tool/package_config.json': The system cannot find the path specified. is thrown.

full error

    C:\flutter\.pub-cache\hosted\pub.dartlang.org\timezone-0.8.0>flutter pub run tool/get -s 2021d
Failed to precompile timezone:get:
Error: Error when reading '../../../global_packages/timezone/.dart_tool/package_config.json': The system cannot find the path specified.

Error: Couldn't resolve the package 'args' in 'package:args/args.dart'.
Error: Couldn't resolve the package 'file' in 'package:file/file.dart'.
Error: Couldn't resolve the package 'glob' in 'package:glob/glob.dart'.
Error: Couldn't resolve the package 'glob' in 'package:glob/list_local_fs.dart'.
Error: Couldn't resolve the package 'logging' in 'package:logging/logging.dart'.
Error: Couldn't resolve the package 'path' in 'package:path/path.dart'.
Error: Couldn't resolve the package 'timezone' in 'package:timezone/src/tools.dart'.
Error: Couldn't resolve the package 'timezone' in 'package:timezone/src/tzdb.dart'.
Error: Couldn't resolve the package 'timezone' in 'package:timezone/timezone.dart'.
pub finished with exit code 1

how can I fix this?

more of the thrown error

    tool/get.dart:16:8: Error: Not found: 'package:args/args.dart'
import 'package:args/args.dart';
       ^
tool/get.dart:17:8: Error: Not found: 'package:file/file.dart'
import 'package:file/file.dart' as pkg_file;
       ^
tool/get.dart:18:8: Error: Not found: 'package:glob/glob.dart'
import 'package:glob/glob.dart';
       ^
tool/get.dart:19:8: Error: Not found: 'package:glob/list_local_fs.dart'
import 'package:glob/list_local_fs.dart';
       ^
tool/get.dart:20:8: Error: Not found: 'package:logging/logging.dart'
import 'package:logging/logging.dart';
       ^
tool/get.dart:21:8: Error: Not found: 'package:path/path.dart'
import 'package:path/path.dart' as p;
       ^
tool/get.dart:23:8: Error: Not found: 'package:timezone/src/tools.dart'
import 'package:timezone/src/tools.dart';
       ^
tool/get.dart:24:8: Error: Not found: 'package:timezone/src/tzdb.dart'
import 'package:timezone/src/tzdb.dart';
       ^
tool/get.dart:25:8: Error: Not found: 'package:timezone/timezone.dart'
import 'package:timezone/timezone.dart';
       ^
tool/get.dart:26:8: Error: Not found: 'package:timezone/tzdata.dart'
import 'package:timezone/tzdata.dart' as tzfile;
       ^
tool/get.dart:45:8: Error: Type 'tzfile.Location' not found.
Future<tzfile.Location> loadTzfileLocation(String name, String path) async {
       ^^^^^^^^^^^^^^^
tool/get.dart:28:17: Error: Method not found: 'join'.
final outPath = p.join('lib', 'data');
                ^^^^
tool/get.dart:47:17: Error: Getter not found: 'Location'.
  return tzfile.Location.fromBytes(name, rawData);
                ^^^^^^^^
tool/get.dart:52:19: Error: Method not found: 'join'.
  final outPath = p.join(dest, 'tzdata$version.tar.gz');
                  ^^^^
tool/get.dart:95:3: Error: Getter not found: 'Logger'.
  Logger.root.level = Level.ALL;
  ^^^^^^
tool/get.dart:95:23: Error: Getter not found: 'Level'.
  Logger.root.level = Level.ALL;
                      ^^^^^
tool/get.dart:96:3: Error: Getter not found: 'Logger'.
  Logger.root.onRecord.listen((LogRecord rec) {
  ^^^^^^
tool/get.dart:96:32: Error: 'LogRecord' isn't a type.
  Logger.root.onRecord.listen((LogRecord rec) {
                               ^^^^^^^^^
tool/get.dart:99:15: Error: Method not found: 'Logger'.
  final log = Logger('main');
              ^^^^^^
tool/get.dart:102:18: Error: Method not found: 'ArgParser'.
  final parser = ArgParser()
                 ^^^^^^^^^
tool/get.dart:113:35: Error: 'Location' isn't a type.
  final tzfileLocations = <tzfile.Location>[];
                                  ^^^^^^^^
tool/get.dart:127:24: Error: Method not found: 'join'.
    final zicDirPath = p.join(tmpDir.path, 'zic');
                       ^^^^
tool/get.dart:133:17: Error: Method not found: 'join'.
      await zic(p.join(tmpDir.path, i), zicDirPath);
                ^^^^
tool/get.dart:137:25: Error: Method not found: 'Glob'.
    final files = await Glob('**/*').list(root: zicDirPath).toList();
                        ^^^^
tool/get.dart:139:25: Error: 'File' isn't a type.
      if (f is pkg_file.File) {
                        ^^^^
tool/get.dart:140:22: Error: Method not found: 'relative'.
        final name = p.relative(f.path, from: zicDirPath);
                     ^^^^^^^^
tool/get.dart:152:14: Error: Method not found: 'LocationDatabase'.
  final db = LocationDatabase();
             ^^^^^^^^^^^^^^^^
tool/get.dart:154:12: Error: Method not found: 'tzfileLocationToNativeLocation'.
    db.add(tzfileLocationToNativeLocation(loc));
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tool/get.dart:156:18: Error: 'FilterReport' isn't a type.
  void logReport(FilterReport r) {
                 ^^^^^^^^^^^^
tool/get.dart:166:17: Error: Method not found: 'filterTimeZoneData'.
  final allDb = filterTimeZoneData(db);
                ^^^^^^^^^^^^^^^^^^
tool/get.dart:170:60: Error: Getter not found: 'commonLocations'.
  final commonDb = filterTimeZoneData(allDb.db, locations: commonLocations);
                                                           ^^^^^^^^^^^^^^^
tool/get.dart:170:20: Error: Method not found: 'filterTimeZoneData'.
  final commonDb = filterTimeZoneData(allDb.db, locations: commonLocations);
                   ^^^^^^^^^^^^^^^^^^
tool/get.dart:177:18: Error: Getter not found: 'commonLocations'.
      locations: commonLocations);
                 ^^^^^^^^^^^^^^^
tool/get.dart:174:25: Error: Method not found: 'filterTimeZoneData'.
  final common_10y_Db = filterTimeZoneData(commonDb.db,
                        ^^^^^^^^^^^^^^^^^^
tool/get.dart:181:23: Error: Method not found: 'join'.
  final allOut = File(p.join(outPath, '${source}_all.tzf'));
                      ^^^^
tool/get.dart:182:26: Error: Method not found: 'join'.
  final commonOut = File(p.join(outPath, '$source.tzf'));
                         ^^^^
tool/get.dart:183:31: Error: Method not found: 'join'.
  final common_10y_Out = File(p.join(outPath, '${source}_10y.tzf'));
                              ^^^^
tool/get.dart:184:29: Error: Method not found: 'tzdbSerialize'.
  await allOut.writeAsBytes(tzdbSerialize(allDb.db), flush: true);
                            ^^^^^^^^^^^^^
tool/get.dart:185:32: Error: Method not found: 'tzdbSerialize'.
  await commonOut.writeAsBytes(tzdbSerialize(commonDb.db), flush: true);
                               ^^^^^^^^^^^^^
tool/get.dart:186:37: Error: Method not found: 'tzdbSerialize'.
  await common_10y_Out.writeAsBytes(tzdbSerialize(common_10y_Db.db),
                                    ^^^^^^^^^^^^^
pub finished with exit code 1
0 Answers
Related