import 'package:flutter/material.dart';
import 'package:kraken/kraken.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
Kraken kraken = Kraken(
// js 文件同样报错
bundle: KrakenBundle.fromUrl('http://192.168.1.180:3333/kraken/home.kbc1'),
);
return MaterialApp(
title: 'Flutter Kraken Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: kraken);
}
}
预期结果 | Expected results:
正常加载文件显示页面
实际结果 | Actual results:
Flutter 端安卓程序黑屏报错
Performing hot restart...
Syncing files to device PRA AL00...
Restarted application in 2,984ms.
E/KRAKEN_NATIVE_LOG( 2690): ReferenceError: 'WebSocket' is not defined
E/KRAKEN_NATIVE_LOG( 2690): at WebSocketClient (internal://:89)
E/KRAKEN_NATIVE_LOG( 2690): at socket (internal://:1948)
E/KRAKEN_NATIVE_LOG( 2690): at ./node_modules/@builder/pack/deps/webpack-dev-server/client/index.js?protocol=ws%3A&hostname=0.0.0.0&port=3334&pathname=%2Fws&logging=warn&reconnect=10 (internal://:427)
E/KRAKEN_NATIVE_LOG( 2690): at call (native)
E/KRAKEN_NATIVE_LOG( 2690): at __webpack_require__ (internal://:17133)
E/KRAKEN_NATIVE_LOG( 2690): at <anonymous> (internal://:18215)
E/KRAKEN_NATIVE_LOG( 2690): at <eval> (internal://:18219)
E/KRAKEN_NATIVE_LOG( 2690):
E/KRAKEN_NATIVE_LOG( 2690): ReferenceError: 'WebSocket' is not defined
E/KRAKEN_NATIVE_LOG( 2690): at WebSocketClient (internal://:89)
E/KRAKEN_NATIVE_LOG( 2690): at socket (internal://:1948)
E/KRAKEN_NATIVE_LOG( 2690): at ./node_modules/@builder/pack/deps/webpack-dev-server/client/index.js?protocol=ws%3A&hostname=0.0.0.0&port=3334&pathname=%2Fws&logging=warn&reconnect=10 (internal://:427)
E/KRAKEN_NATIVE_LOG( 2690): at call (native)
E/KRAKEN_NATIVE_LOG( 2690): at __webpack_require__ (internal://:17133)
E/KRAKEN_NATIVE_LOG( 2690): at <anonymous> (internal://:18215)
E/KRAKEN_NATIVE_LOG( 2690): at <eval> (internal://:18219)
E/KRAKEN_NATIVE_LOG( 2690):
使用的 Kraken 版本 | What version of kraken are you using
v0.11.0
重现步骤 | Steps To Reproduce
新建 rax-app 工程然后运行 npm start 得到 http://192.168.1.180:3333/kraken/home.kbc1 然后通过 Flutter 端加载该文件。
重现代码 | Code example:
预期结果 | Expected results: 正常加载文件显示页面
实际结果 | Actual results: Flutter 端安卓程序黑屏报错