TokTok / btox

Official TokTok mobile Tox client
https://tox.chat/
GNU General Public License v3.0
12 stars 4 forks source link

need a guide for how to build #29

Closed thomas725 closed 1 year ago

thomas725 commented 2 years ago

Hi there!

I'd like to take a look at your project. I've cloned your repo and opened it with vs code (with dart+flutter plugins) but it doesn't seem to work out of the box like other flutter projects. Can you give me some hints how you are building / developing this app?

Thanks!

thomas725 commented 2 years ago

running flutter run --verbose on the command line ends with those errors:

lib/db/database.dart:3:6: Error: Error when reading 'lib/db/database.g.dart': No such file or directory
part 'database.g.dart';
     ^
lib/db/database.dart:3:6: Error: Can't use 'lib/db/database.g.dart' as a part, because it has no 'part of' declaration.
part 'database.g.dart';
     ^
lib/db/database.dart:18:24: Error: Type '_$Database' not found.
class Database extends _$Database {
                       ^^^^^^^^^^
lib/db/database.dart:28:19: Error: Type 'ContactsCompanion' not found.
  void addContact(ContactsCompanion entry) => into(contacts).insert(entry);
                  ^^^^^^^^^^^^^^^^^
lib/db/database.dart:30:15: Error: Type 'Contact' not found.
  Stream<List<Contact>> watchContacts() => select(contacts).watch();
              ^^^^^^^
lib/db/database.dart:32:10: Error: Type 'Contact' not found.
  Stream<Contact> watchContact(int id) =>
         ^^^^^^^
lib/db/database.dart:35:19: Error: Type 'MessagesCompanion' not found.
  void addMessage(MessagesCompanion entry) => into(messages).insert(entry);
                  ^^^^^^^^^^^^^^^^^
lib/db/database.dart:37:15: Error: Type 'Message' not found.
  Stream<List<Message>> watchMessagesFor(int id) =>
              ^^^^^^^
lib/contact_list_page.dart:17:9: Error: Type 'Contact' not found.
  final Contact contact;
        ^^^^^^^
lib/contact_list_page.dart:18:18: Error: Type 'Contact' not found.
  final Function(Contact) onTap;
                 ^^^^^^^
lib/chat_page.dart:14:16: Error: Type 'Contact' not found.
  final Stream<Contact> contact;
               ^^^^^^^
lib/chat_page.dart:15:21: Error: Type 'Message' not found.
  final Stream<List<Message>> messages;
                    ^^^^^^^
lib/db/database.dart:19:36: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
  Database(QueryExecutor e) : super(e);
                                   ^
lib/db/database.dart:26:38: Error: The getter 'destructiveFallback' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'destructiveFallback'.
  MigrationStrategy get migration => destructiveFallback;
                                     ^^^^^^^^^^^^^^^^^^^
lib/db/database.dart:28:19: Error: 'ContactsCompanion' isn't a type.
  void addContact(ContactsCompanion entry) => into(contacts).insert(entry);
                  ^^^^^^^^^^^^^^^^^
lib/db/database.dart:28:47: Error: The method 'into' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'into'.
  void addContact(ContactsCompanion entry) => into(contacts).insert(entry);
                                              ^^^^
lib/db/database.dart:28:52: Error: The getter 'contacts' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'contacts'.
  void addContact(ContactsCompanion entry) => into(contacts).insert(entry);
                                                   ^^^^^^^^
lib/db/database.dart:30:44: Error: The method 'select' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'select'.
  Stream<List<Contact>> watchContacts() => select(contacts).watch();
                                           ^^^^^^
lib/db/database.dart:30:51: Error: The getter 'contacts' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'contacts'.
  Stream<List<Contact>> watchContacts() => select(contacts).watch();
                                                  ^^^^^^^^
lib/db/database.dart:33:8: Error: The method 'select' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'select'.
      (select(contacts)..where((c) => c.id.equals(id))).watchSingle();
       ^^^^^^
lib/db/database.dart:33:15: Error: The getter 'contacts' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'contacts'.
      (select(contacts)..where((c) => c.id.equals(id))).watchSingle();
              ^^^^^^^^
lib/db/database.dart:35:19: Error: 'MessagesCompanion' isn't a type.
  void addMessage(MessagesCompanion entry) => into(messages).insert(entry);
                  ^^^^^^^^^^^^^^^^^
lib/db/database.dart:35:47: Error: The method 'into' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'into'.
  void addMessage(MessagesCompanion entry) => into(messages).insert(entry);
                                              ^^^^
lib/db/database.dart:35:52: Error: The getter 'messages' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'messages'.
  void addMessage(MessagesCompanion entry) => into(messages).insert(entry);
                                                   ^^^^^^^^
lib/db/database.dart:38:8: Error: The method 'select' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'select'.
      (select(messages)..where((m) => m.contactId.equals(id))).watch();
       ^^^^^^
lib/db/database.dart:38:15: Error: The getter 'messages' isn't defined for the class 'Database'.
 - 'Database' is from 'package:btox/db/database.dart' ('lib/db/database.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'messages'.
      (select(messages)..where((m) => m.contactId.equals(id))).watch();
              ^^^^^^^^
lib/contact_list_page.dart:17:9: Error: 'Contact' isn't a type.
  final Contact contact;
        ^^^^^^^
lib/contact_list_page.dart:18:18: Error: 'Contact' isn't a type.
  final Function(Contact) onTap;
                 ^^^^^^^
lib/contact_list_page.dart:45:7: Error: The getter 'ContactsCompanion' isn't defined for the class '_ContactListPageState'.
 - '_ContactListPageState' is from 'package:btox/contact_list_page.dart' ('lib/contact_list_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'ContactsCompanion'.
      ContactsCompanion.insert(
      ^^^^^^^^^^^^^^^^^
lib/contact_list_page.dart:145:32: Error: 'Contact' isn't a type.
      body: StreamBuilder<List<Contact>>(
                               ^^^^^^^
lib/contact_list_page.dart:155:25: Error: 'Contact' isn't a type.
                onTap: (Contact contact) {
                        ^^^^^^^
lib/contact_list_page.dart:163:54: Error: The getter 'MessagesCompanion' isn't defined for the class '_ContactListPageState'.
 - '_ContactListPageState' is from 'package:btox/contact_list_page.dart' ('lib/contact_list_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'MessagesCompanion'.
                          widget.database.addMessage(MessagesCompanion.insert(
                                                     ^^^^^^^^^^^^^^^^^
lib/chat_page.dart:14:16: Error: 'Contact' isn't a type.
  final Stream<Contact> contact;
               ^^^^^^^
lib/chat_page.dart:15:21: Error: 'Message' isn't a type.
  final Stream<List<Message>> messages;
                    ^^^^^^^
lib/chat_page.dart:34:26: Error: 'Contact' isn't a type.
    return StreamBuilder<Contact>(
                         ^^^^^^^
lib/chat_page.dart:43:41: Error: 'Message' isn't a type.
              child: StreamBuilder<List<Message>>(
                                        ^^^^^^^
lib/chat_page.dart:46:54: Error: 'Message' isn't a type.
                  final messages = snapshot.data ?? <Message>[];
                                                     ^^^^^^^
thomas725 commented 2 years ago

So I guess since lib/db/database.g.dart is excluded from git by the lib/db/.gitignore file this probably should be generated by some pre-build step. Didn't see any hints on what that is and how to start it yet though.

thomas725 commented 2 years ago

Ah now I found the script tools/prepare which created the missing file.

robinlinden commented 2 years ago

Hi! I opened a PR adding (very basic) build instructions to the readme. Please take a look if you're interested. :)

Out of interest, did you end up doing anything with bTox after you got it building?

thomas725 commented 2 years ago

Hi there! Sorry no, I did not do anything with it after I got it building. I saw it looked like a mostly feature-empty sample flutter app and I did not understand what your code does (I'm a flutter newbie).

At the moment I'm looking at the flutter-rust-bridge, interested in using the rust libp2p library together with it to build a p2p app.