Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Randal L. Schwartz
@RandalSchwartz
when in doubt, read the doc.
ahh, it is VALUES
Spencer Riddering
@SpencerRiddering

If I have published Android and iOS apps, and I want to create a new screen using Flutter that both the Android and iOS apps incorporate. What's the best way to do this? I've read the flutter.dev instructions regarding creating a module. Even if I add a module to both Android and iOS projects, I'm still not sharing code between the projects yet. So this is what I believe I need to do:

  1. Add Android module.
  2. Add iOS module.
  3. Create a package that contains all code for the new screen.
  4. Add this new package as a dependency of the Android and iOS modules created in steps 1 and 2.

Does this look right? Have I missed something?

1 reply
Kyle
@kyle21z
@RandalSchwartz would you mind including an example, I couldn't really understand. I believe the SQL code itself doesn't work yet I can't seem to understand why
Randal L. Schwartz
@RandalSchwartz
show me these two things: the entire “create table” statement, and the entire “insert into” statement.
Kyle
@kyle21z
create
void _onCreate(Database db, int version) async {
    await db.execute("CREATE TABLE " +
        TASK_TABLE_NAME +
        " ("
            "id STRING PRIMARY KEY, "
            "tasktype TEXT, "
            "tasktitle TEXT, "
            "taskdescription TEXT, "
            "taskcompleted TEXT, "
            "datetime TEXT, "
            "datetimedue TEXT, "
            "taskpriority TEXT)");
  }
add
newTask(newTask) async {
    var dbClient = await db;
    var result = await dbClient.rawInsert(
        "INSERT INTO " +
            TASK_TABLE_NAME +
            " ("
                "id STRING PRIMARY KEY, "
                "tasktype TEXT, "
                "tasktitle TEXT, "
                "taskdescription TEXT, "
                "taskcompleted TEXT, "
                "datetime TEXT, "
                "datetimedue TEXT, "
                "taskpriority TEXT) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
        [
          newTask.datetime,
          newTask.taskType,
          newTask.taskTitle,
          newTask.taskDescription,
          newTask.taskCompleted,
          newTask.datetime,
          newTask.datetimedue,
          newTask.taskPriority
        ]);
    return result;
  }
Randal L. Schwartz
@RandalSchwartz
yeah, wrong syntax for insert
no types allowed there
types are all in the create table stratement.
so it should be more like task_table_name + “(id, tasktype, tasktitle …) values ( … )"
Kyle
@kyle21z
ill try hang on
Johannes Milke
@JohannesMilke_twitter
Hello! I have created another video about "WillPopScope & BackButton - Navigate Back Android - Flutter" https://www.youtube.com/watch?v=do5Ppu7Nfpg alt
Randal L. Schwartz
@RandalSchwartz
ooh, I don’t know the parameters for rawInsert
my advice is based on just sqlite.
Kyle
@kyle21z
@RandalSchwartz what a hero!
thank you c:
rawinsert is inserting the data into the database right?
Randal L. Schwartz
@RandalSchwartz
I don’t know. I know sqlite but not sqflite yet.
yeah, your syntax matches
int id2 = await txn.rawInsert(
      'INSERT INTO Test(name, value, num) VALUES(?, ?, ?)',
      ['another name', 12345678, 3.1416]);
  print('inserted2: $id2');
});
from the official doc
Ghost
@ghost~5f8f66f2d73408ce4ff20dd5
whats the best way to wait for an async function in a synchronous function?
Randal L. Schwartz
@RandalSchwartz
You can’t.
If any method is marked async, or uses the explicit Future/Stream protocol, everything that invokes it (and recursively) must also be non-blocking.
Randal L. Schwartz
@RandalSchwartz
More simply, if it returns a Future<…> or a Stream<…>, it and everything that invokes it must be treated as returning a Future or Stream.
matrixbot
@matrixbot
yeetmeokayimdead2222 hi
yeetmeokayimdead2222 what is future/stream?
matrixbot
@matrixbot
yeetmeokayimdead2222 thank u
Randal L. Schwartz
@RandalSchwartz
You’re welcome!
matrixbot
@matrixbot
yeetmeokayimdead2222 so, what is this group about!?
Randal L. Schwartz
@RandalSchwartz
Are you trolling now? Why would you ask about future/stream without some idea of the channel?
matrixbot
@matrixbot
yeetmeokayimdead2222 ...
yeetmeokayimdead2222 um
Randal L. Schwartz
@RandalSchwartz
this is a serious discussion about the framework described at http://flutter.dev
matrixbot
@matrixbot
yeetmeokayimdead2222 oh ok
yeetmeokayimdead2222 thanks again
Ghost
@ghost~5f8f66f2d73408ce4ff20dd5
@RandalSchwartz thank you
So many things I am trying to do dont work without explanation
=$
Randal L. Schwartz
@RandalSchwartz
heh
matrixbot
@matrixbot
yeetmeokayimdead2222 ...
yeetmeokayimdead2222 what does flutter mean in a business
Ghost
@ghost~5f8f66f2d73408ce4ff20dd5
I am trying to control the state in a series of children from the main thread which is reading multicast data. The only way I have found to do this is to create a thread with a receive port, that sends its sendPort to the main thread an the main thread passes that sendport to each child widget, and those child widgets create receive ports and send their send ports to that main receive port
very convoluted
Getting hung up on the fact that Statefulwidgets constructors are synchronous and cant synchronize an asynchronous call
*gasp
matrixbot
@matrixbot
yeetmeokayimdead2222 oh