不能与SQLJocky一起使用(未定义的类'SHA1'和其他错误)

时间:2018-07-13 00:27:13

标签: mysql dart sqljocky

如果我尝试为我的dart应用程序提供服务,则会出现以下错误:

Serving `web` on http://localhost:80 [INFO]
    ------------------------------------------------------------------------ [INFO] Starting Build [INFO] Updating asset graph completed, took 15ms [WARNING] build_web_compilers|entrypoint on web/main.dart: Unable to read sqljocky|lib/sqljocky.ddc.js, check your console or the `.dart_tool/build/generated/sqljocky/lib/sqljocky.ddc.js.errors` log file. [INFO] Running build completed, took 22.2s [INFO] Caching finalized dependency graph completed, took 622ms [SEVERE] build_web_compilers|ddc on package:sqljocky/sqljocky.module: Error compiling dartdevc module:sqljocky|lib/sqljocky.ddc.js

    [error] Undefined class 'SHA1'. (package:sqljocky/src/auth/auth_handler.dart, line 24, col 24) [error] Undefined class 'SHA1'. (package:sqljocky/src/auth/auth_handler.dart, line 28, col 20) [error] Undefined class 'SHA1'. (package:sqljocky/src/auth/auth_handler.dart, line 32, col 20) [error] Invalid override. The type of 'ConnectionPool._removeConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._removeConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/connection_pool.dart, line 85, col 3) [error] Invalid override. The type of 'ConnectionPool._releaseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._releaseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/connection_pool.dart, line 89, col 3) [error] Invalid override. The type of 'ConnectionPool._reuseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._reuseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/connection_pool.dart, line 105, col 3) [error] Invalid override. The type of '_QuitHandler.processResponse' ('(Buffer) → dynamic') isn't a subtype of '_Handler.processResponse' ('(Buffer) → _HandlerResponse'). (package:sqljocky/src/handlers/quit_handler.dart, line 14, col 3) [error] Invalid override. The type of 'Query._releaseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._releaseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/query.dart, line 170, col 3) [error] Invalid override. The type of 'Query._reuseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._reuseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/query.dart, line 179, col 3) [error] Invalid override. The type of 'Query._removeConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._removeConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/query.dart, line 185, col 3) [error] Invalid override. The type of 'Transaction._releaseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._releaseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/transaction.dart, line 85, col 3) [error] Invalid override. The type of 'Transaction._reuseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._reuseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/transaction.dart, line 89, col 3) [error] Invalid override. The type of 'Transaction._removeConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._removeConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/transaction.dart, line 93, col 3)

    Please fix all errors before compiling (warnings are okay). }

[SEVERE] Failed after 22.8s

我没有使用SQLJocky的任何功能,这些是我的导入内容:

import 'dart:async';
import 'dart:convert';

import 'package:angular/angular.dart';
import 'package:angular_components/angular_components.dart';
import 'package:sqljocky/sqljocky.dart';
import 'package:sqljocky/utils.dart';
import 'package:options_file/options_file.dart';

我的pubspec.yaml:

name: MyDartPage
description: A web app that uses AngularDart Components
# version: 1.0.0
# homepage: https://www.example.com
# author: Mattia <email@example.com>

environment:
  sdk: '>=2.0.0-dev.66.0 <2.0.0'

dependencies:
  angular: any
  angular_components: any
  sqljocky: any


dev_dependencies:
  angular_test: any
  build_runner: any
  build_test: any
  build_web_compilers: any
  test: any

在它看起来像这样之前:

name: MyDartPage
description: A web app that uses AngularDart Components
# version: 1.0.0
# homepage: https://www.example.com
# author: Mattia <email@example.com>

environment:
  sdk: '>=2.0.0-dev.66.0 <2.0.0'

dependencies:
  angular: ^5.0.0-beta
  angular_components: ^0.9.0-beta
  sqljocky: ^0.14.0

dev_dependencies:
  angular_test: ^2.0.0-beta
  build_runner: ^0.9.0
  build_test: ^0.10.2
  build_web_compilers: ^0.4.0
  test: ^1.0.0

但是由于以下错误,我不得不更改它:

  

因为每个版本的build_runner都取决于crypto> = 0.9.2 <3.0.0   和crypto> = 0.9.2 <2.0.1取决于convert ^ 1.0.0,每个版本   build_runner需要转换^ 1.0.0或加密^ 2.0.1。而且因为   build_runner> = 0.6.1取决于转换^ 2.0.1和sqljocky> = 0.7.0   取决于密码^ 0.9.0,build_runner> = 0.6.1与   sqljocky> = 0.7.0。因此,因为MyDartPage同时依赖于sqljocky   ^ 0.14.0和build_runner ^ 0.9.0,版本解析失败。

我的飞镖版本是:

  

Dart VM版本:2.0.0-dev.67.0(2018年7月3日星期二18:17:07 +0200)   “ windows_x64”

如何解决这两个错误?

1 个答案:

答案 0 :(得分:0)

我使用SQLJocky5解决了问题,但在Dart 2上我必须进行PR修复: https://github.com/dart-db/sqljocky5/pull/10