I want to show data from mysql database on browser using dart -
i'm working on school project, requires show simple data mysql database in browser. i've read, sqljocky doesn't work in browser decided make server-client app , run db on server side (got inspiration here: https://dart-lang.github.io/server/codelab/). didn't work, failed in creating client api message:
*in shutdownisolate: unhandled exception: isolatespawnexception: unable spawn isolate: unhandled exception: load error "package:sqljocky/sqljocky.dart": no mapping 'sqljocky' package when resolving 'package:sqljocky/sqljocky.dart'. #0 _asyncloaderrorcallback (dart:_builtin:155) #1 _asyncloaderror (dart:_builtin:566) #2 _loadpackage (dart:_builtin:605) #3 _loaddata (dart:_builtin:637) #4 _loaddataasync (dart:_builtin:657) #5 _loadscriptcallback (dart:_builtin:153) #6 _handleloaderreply (dart:_builtin:370) #7 _rawreceiveportimpl._handlemessage (dart:isolate-patch/isolate_patch.dart:148) 'file:///home/alenka/dart-pokusy/server-side-app/one-hour-codelab/server/7-serve/lib/server/dbconnector.dart': error: line 1 pos 1: library handler failed import 'package:sqljocky/sqljocky.dart'; ^ #0 isolate.spawnuri.<spawnuri_async_body> (dart:isolate-patch/isolate_patch.dart) #1 _asyncerrorwrapperhelper.<anonymous closure> (dart:async-patch/async_patch.dart:34) #2 _rootzone.runbinary (dart:async/zone.dart:1154) #3 _future._propagatetolisteners.handleerror (dart:async/future_impl.dart:579) #4 _future._propagatetolisteners (dart:async/future_impl.dart:641) #5 _future._completeerror (dart:async/future_impl.dart:432) #6 _synccompleter._completeerror (dart:async/future_impl.dart:56) #7 _completer.completeerror (dart:async/future_impl.dart:27) #8 isolate._spawncommon.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:439) #9 _rawreceiveportimpl._handlemessage (dart:isolate-patch/isolate_patch.dart:148)*
does have idea how solve problem, or how data db in browser differently?
code added containing things sqljocky:
`import 'package:sqljocky/sqljocky.dart'; import 'dart:async'; ... @apimethod(path: 'connect') future<list<string>> dbconnect() async { list<string> rows = []; print('called dbconnect'); var pool = new connectionpool( host: 'localhost', port: 3306, user: "root", password: null, db: 'project', max: 5); print('connection created'); var results = await pool.query('select * user'); print('gonna write db'); results.foreach( (row){ print('name: ${row[0]}, password: ${row[1]}'); rows.add('name: ${row[0]}, password: ${row[1]}'); }); return rows; } `
isolate server side code , client side code separates projects own pubspec.yaml.
i've found sqljocky doesn't play nice of client side libraries when both in pubspec.yaml.
Comments
Post a Comment