Coder Social home page Coder Social logo

hhtokpinar / sqfentity Goto Github PK

View Code? Open in Web Editor NEW
377.0 18.0 100.0 189.6 MB

SqfEntity ORM for Flutter/Dart lets you build and execute SQL commands on SQLite database easily and quickly with the help of fluent methods similar to .Net Entity Framework. SqfEntity also generates add/edit forms with validations and special controls (DropDown List, DateTime pickers, Checkboxes.. etc) for your table.

Dart 88.43% Shell 0.12% Kotlin 0.04% Ruby 0.64% Objective-C 0.01% Swift 0.49% HTML 0.35% CMake 4.33% C++ 5.26% C 0.33%
sqlite-database sqf-entity database-models sqfentity-orm sqflite flutter-plugin sqfentity generate-input-form generate-model-from-db sqlite-orm

sqfentity's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sqfentity's Issues

db folder

Hi ,thanks for rescue me from sqflite hell,
how to access db folder?

How to generate fieldName tabel without camelCase ?

Hello, I have a json response with uppercase keyName, but when generate DbModel, the first character of fieldName table is lowercase. For example, in json response is MONTH_NAME but in the result table field is mONTH_NAME. So I get null value when mapping json to tables object. How to generate a DbModel with the original field name?

models.dart cut-off before all model data has been dumped to debug pane

my model contains 10+ tables.
However, the created model seems to be cut-off after the first two tables...

` /// returns Config by ID if exist, othe<…>

flutter: SQFENTITIY: [databaseTables] Model was created successfully. Create models.dart file in your project and press Ctrl+V to paste the model from the Clipboard
flutter: SQFENTITIY: Table named 'BlocksTrainingsScaling' was initialized successfuly (No added new columns)`

Is there a way to write the models.dart data in larger chunks?

Acknowledgement on data Saved

Is there a way to get some acknowldegement when the data was saved?
currently I am declaring a table with employeeId set as a PRIMARY KEY with Unique field

const assetRequests = SqfEntityTable(
    tableName: 'DeviceRequestModel',
    primaryKeyName: 'employeeId',
    primaryKeyType: PrimaryKeyType.integer_unique,
    useSoftDeleting: true,
    modelName: null,
....
....

Suppose my database already has only one entry with employeeId 10 and when I make another entry with same employeeId it returns me 2 but It does not get added to database how do I know in this scenario that the entry was saved or not because the database returns the nth entry.

save() throws exception NoSuchMethodError for saveResult

It seems like there is no attribute saveResult of the generated model classes. When creating a new instance of my model Product, setting some attributes and calling await product.save(); following error shows up:

E/flutter (15860): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: Class 'Product' has no instance setter 'saveResult='.
E/flutter (15860): Tried calling: saveResult=Instance of 'BoolResult'
E/flutter (15860): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
E/flutter (15860): #1      SqfEntityProvider.insert (package:sqfentity/sqfentity.dart:258:9)
E/flutter (15860): <asynchronous suspension>
E/flutter (15860): #2      Product.save (package:example/model/model.g.dart:365:29)

Using

sqfentity 1.2.0+11
sqfentity_gen 1.1.0+5
sqflite 1.1.7+1

isNull() throws exception

In my example I got an exception:
Cannot bind argument at index 4 because the index is out of range. The statement has 3 parameters.

As I can see from the code isNull() is adding element 0 to arguments but SqlSyntax.IsNULL has no question mark.

Batch Insert (Insert multiple records)

With sqflite can be insert multiple records by batch commit,this is useful for many cases especially in preloading data in first app start .I got this error Warning database has been locked for 0:00:10.000000. Make sure you always use the transaction object for database operations during a transaction when i tried insert 2000 records by sqfEntity like this:

Activity activity = Activity();
activity.id =
int.parse(activityTemp.id);
activity.met = double.parse(
activityTemp.met);
await activity.save();

bach query in sqflite :

batch = db.batch();
batch.insert('Test', {'name': 'item'});
batch.update('Test', {'name': 'new_item'}, where: 'name = ?', whereArgs: ['item']);
batch.delete('Test', where: 'name = ?', whereArgs: ['item']);
results = await batch.commit();

can't locate import sqfentitybase

Hi, I have created my model and pasted it into a new model.dart file.

There is an import 'package:sqfentity/db/sqfEntityBase.dart' that seems not to be installed when the plugin is pulled on android studio. Is there a manual download option? I can't find the file on GitHub either.

Thanks

findById with null argument throws exception instead of returning null

Thanks for the good work. I just switched from the jaguar_orm and found one thing that would be great to improve.

Now, when calling findById I have to do a null check before calling the method.

It works for me, but probably it would be best to return null when the argument is null.

How to dynamic change database name?

Because my app must created database file by user_id.
The path of database file, just like 'user_id/mydb.db'.

I try extend the SqfEntityModel to init DB, just like

class DatabaseModel extends SqfEntityModel {
 static const String _databaseName = "mydb.db";
 DatabaseModel() {
   databaseTables = [ TableEvent.getInstance];
 }

 void setUserId(String userId) {
    databaseName = "$userId/$_databaseName";
 }
}

it's work on old version.
But new version of SqfEntityModel, don't support extended to do.

How can I to implement dynamic change database name?
Thank you.

Unhandled Exception: Invalid argument: Instance of 'DateTime'

My model definition includes a datetime field.

...
fields: [
  SqfEntityField('name', DbType.text),
  SqfEntityField('paidAt', DbType.datetime),
  ...
]);

When updating an instance of the model with the current date and calling .save() the Invalid argument exception is thrown.

instance.paidAt = DateTime.now();
instance.save();
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Invalid argument: Instance of 'DateTime'
#0      StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:392:7)
#1      StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:382:9)
#2      StandardMessageCodec.writeValue.<anonymous closure> (package:flutter/src/services/message_codecs.dart:389:9)
#3      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
#4      StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:387:13)
#5      StandardMethodCodec.encodeMethodCall (package:flutter/src/services/message_codecs.dart:524:18)
#6      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:311:13)
<asynchronous suspension>
#7      invokeMethod (package:sqflite/src/sqflite_impl.dart:20:13)
#8      SqfliteDatabaseFactoryImpl.invokeMethod (package:sqflite/src/factory_impl.dart:29:7)
#9      SqfliteDatabaseMixin.invokeMethod (package:sqflite/src/database_mixin.dart:267:15)
#10     SqfliteDatabaseMixin.safeInvokeMethod.<anonymous closure> (package:sqflite/src/database_mixin.dart:188:43)
#11     wrapDatabaseException (package:sqflite/src/exception_impl.dart:8:34)
<asynchronous suspension>
#12     SqfliteDatabaseFactoryImpl.wrapDatabaseException (package:sqflite/src/factory_impl.dart:25:7)
#13     SqfliteDatabaseMixin.safeInvokeMethod (package:sqflite/src/database_mixin.dart:188:15)
#14     SqfliteDatabaseMixin.txnRawInsert.<anonymous closure> (package:sqflite/src/database_mixin.dart:363:14)
#15     SqfliteDatabaseMixin.txnSynchronized.<anonymous closure> (package:sqflite/src/database_mixin.dart:307:22)
#16     BasicLock.synchronized (package:synchronized/src/basic_lock.dart:31:26)
<asynchronous suspension>
#17     SqfliteDatabaseMixin.txnSynchronized (package:sqflite/src/database_mixin.dart:303:43)
<asynchronous suspension>
#18     SqfliteDatabaseMixin.txnWriteSynchronized (package:sqflite/src/database_mixin.dart:325:7)
#19     SqfliteDatabaseMixin.txnRawInsert (package:sqflite/src/database_mixin.dart:362:12)
#20     SqfliteDatabaseExecutorMixin.rawInsert (package:sqflite/src/database_mixin.dart:49:15)
#21     SqfEntityProvider.rawInsert (package:sqfentity/sqfentity.dart:268:29)
<asynchronous suspension>
#22     Sell._upsert (package:example/model/model.g.dart:4391:31)
<asynchronous suspension>
#23     Sell.save (package:example/model/model.g.dart:4364:18)

Using

sqfentity 1.2.1
sqfentity_gen 1.1.1+3
sqflite 1.1.7+2

Syncronize data from the web

how to fetch the list of changes made to the local database so those can be synchronized efficiently
with the online database some example would be really helpful

add "toJson" to model creation logic for database objects

it would be great to add a "toJson" function to each of the database table objects that are created in the model.
It would make sending DB data via http api calls much easier.
Would you be interested in adding this, or would you like help with that?

Cheers

Find method report error, delete method invalid

const tableYYL = SqfEntityTable(
tableName: 'bleDevice',
primaryKeyName: 'macID',
primaryKeyType: PrimaryKeyType.text,
useSoftDeleting: false,
modelName:
null,
fields: [
SqfEntityField('name', DbType.text),
]);

void startdb() async {
final data1 = await BleDevice.withId("yyl", "name").save(); //ok
final data2 = await BleDevice().getById("yyl"); //error
final data3 = await BleDevice.withId("yyl", "name").delete(); //error
}

Is it possible to add “autoincrement” options to the table definition in the model?

@hellowtisch you asked me that "Is it possible to add “autoincrement” options to the table definition in the model?"
here it is:

  1. Add a sequence in your model first
class SequenceSample extends SqfEntitySequence {
  SequenceSample() {
    sequenceName = "sample";
    //maxValue = 10000;     /* optional. default is max int (9.223.372.036.854.775.807) */
    //cycle = false;      /* optional. default is false; */
    //minValue = 0;    /* optional. default is 0 */
    //incrementBy = 1; /* optional. default is 1 */
    // startWith = 0;  /* optional. default is 0 */
    super.init();
  }
  static SequenceSample _instance;
  static SequenceSample get getInstance {
    if (_instance == null) {
      _instance = SequenceSample();
    }
    return _instance;
  }
}
  1. Put your sequences into the sequences list.
class MyDbModel extends SqfEntityModel {
MyDbModel() {
databaseName = "sampleORM.db";
databaseTables = [ your tables.. ];
sequences = [SequenceSample.getInstance];
}
  1. Attach sequence to your autoincremented field

SqfEntityField("rownum", DbType.integer, defaultValue: "0", sequencedBy: SequenceSample.getInstance)

  1. re-generate your model..
    You can also generate model from application interface
    PREVIEW

That's all.. Hope this helps you

Originally posted by @hhtokpinar in #17 (comment)

Using an undefined, downloadable table

Hi!
You have been helping me here:
tekartik/sqflite#186
But I have decided to bring the conversation here, for more streamlined attention.

Now, the package looks so promising!
You have put-in a lot of work into this...and all I can say right now is...wow!
I am primarily from the web, and this reminds me alot about Laravel's Eloquent and Rails Active Record.
This is a job well done!
Thanks for all your hard labour!!!

I have got couple of questions though, concerning my project:

  1. While reading the docs, I noticed that there is a need to declare my tables ahead of time.
    In class MyDbModel extends SqfEntityModel
    I will need to provide:
    databaseTables
    I think I should give a little background into what I am working on, to show why I think that this might be a little impractical for my purpose.
    So, I am working on a bible app.
    I know, I know, there are millions of such app in existence.
    But I chose the project to help stretch my understanding about flutter and dart.
    See, I am new to mobile development, and I wanted something a little bit complicated to just a Todo List app.
    Lol.
    Ok.
    So, my idea so far is that, I bundle a database (with a default bible) withing the app, which gets loaded when the app gets used for the first time.
    Then, I want users to go to a download page, and pick any version they like to download.
    Each version gets a table.
    At inception, the only table exsiting would be the default table.
    As users download, new table for the new version gets installed.
    And this plan is working so far.
    But I am not OK with the performance.
    As I noted in the issue I filed on the sqflite page, there is a bit of jank whenever I ask the db instance to insert the record into the database.
    Here is my process:
  2. I check if the requested db_name already exists in the database.
  3. Then I spin an isolate.
  4. Within the Isolate, I submit a get request to retrieve the selected bible version from the server.
  5. When it returns, the selected table gets created.
  6. And the isolates loop through the downloaded json.
  7. Within the each, a sendpPort.send() method call is made to the receive port.
  8. The receive port listened and install/insert the record into the table.
  9. This works fine. But while the listenener is inserting the record, the main thread is blocked.
  10. I have a spiner, and it also stops rolling.
  11. This is why I need to figure out how to run the process of inserting records when I am within the isolate and not outside of it.

So, seeing that there are tables that need to be downloaded only when required, how do you suggest I go about this?

  1. Secondly, how do you think this package can help me prevent jank when the insertion is taking place.

That's all.
Apologies for bombarding you with so much!
But I am glad I have someone I can share this challenge with.

Thanks so much!!!!

Cant start this package;

I am unable to initialise the package at all, I am wondering what the problem is?

import 'package:sqfentity/sqfentity.dart';
import 'package:sqfentity_gen/sqfentity_gen.dart';

final bundledDbModel = await convertDatabaseToModelBase(
      databaseName: 'organise.db', bundledDatabasePath: 'assets/organise.sqlite');

  final String modelConstString =
      SqfEntityConverter(bundledDbModel).createConstDatabase();

  //await Clipboard.setData(ClipboardData(text: modelConstString));

Error message

Compiler message:
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:33:33: Error: Type 'SqfEntityModelBase' not found.
class SqfEntityProvider extends SqfEntityModelBase {
                                ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:105:10: Error: Type 'BoolResult' not found.
  Future<BoolResult> execSQL(String pSql, [List<dynamic> arguments]) async {
         ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:120:10: Error: Type 'BoolResult' not found.
  Future<BoolResult> execSQLList(List<String> pSql) async {
         ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:164:23: Error: Type 'QueryParams' not found.
  Future<List> toList(QueryParams params) async {
                      ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:197:10: Error: Type 'BoolResult' not found.
  Future<BoolResult> delete(QueryParams params) async {
         ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:197:29: Error: Type 'QueryParams' not found.
  Future<BoolResult> delete(QueryParams params) async {
                            ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:211:10: Error: Type 'BoolResult' not found.
  Future<BoolResult> updateBatch(
         ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:212:7: Error: Type 'QueryParams' not found.
      QueryParams params, Map<String, dynamic> values) async {
      ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:247:15: Error: Type 'BoolResult' not found.
  Future<List<BoolResult>> rawInsertAll(
              ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:268:15: Error: Type 'BoolResult' not found.
  Future<List<BoolResult>> saveAll(String pSql, List T) async {
              ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:299:24: Error: Type 'SqfEntitySequenceBase' not found.
  Future<int> sequence(SqfEntitySequenceBase seq, bool increase,
                       ^^^^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:331:47: Error: Type 'SqfEntityModelBase' not found.
abstract class SqfEntityModelProvider extends SqfEntityModelBase {
                                              ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:445:10: Error: Type 'BoolResult' not found.
  Future<BoolResult> execSQL(String sql, [List<dynamic> arguments]) async {
         ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:450:10: Error: Type 'BoolResult' not found.
  Future<BoolResult> execSQLList(List<String> sql) async {
         ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:466:35: Error: Type 'SqfEntityTableBase' not found.
bool checkForIsReadyDatabase(List<SqfEntityTableBase> dbTables) {
                                  ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:475:32: Error: Type 'SqfEntityTableBase' not found.
List<String> checkTableIndexes(SqfEntityTableBase table) {
                               ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:487:5: Error: Type 'SqfEntityTableBase' not found.
    SqfEntityTableBase table, List<TableField> exitingDBfields) {
    ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:487:36: Error: Type 'TableField' not found.
    SqfEntityTableBase table, List<TableField> exitingDBfields) {
                                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:522:8: Error: Type 'SqfEntityModelBase' not found.
Future<SqfEntityModelBase> convertDatabaseToModelBase(
       ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:106:11: Error: 'BoolResult' isn't a type.
    final BoolResult result = BoolResult();
          ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:106:31: Error: Method not found: 'BoolResult'.
    final BoolResult result = BoolResult();
                              ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:106:31: Error: The method 'BoolResult' isn't defined for the class
'SqfEntityProvider'.
 - 'SqfEntityProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing method, or defining a method named
'BoolResult'.
    final BoolResult result = BoolResult();
                              ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:122:20: Error: Method not found: 'BoolResult'.
    final result = BoolResult(success: false);
                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:122:20: Error: The method 'BoolResult' isn't defined for the class
'SqfEntityProvider'.
 - 'SqfEntityProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing method, or defining a method named
'BoolResult'.
    final result = BoolResult(success: false);
                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:164:23: Error: 'QueryParams' isn't a type.
  Future<List> toList(QueryParams params) async {
                      ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:197:29: Error: 'QueryParams' isn't a type.
  Future<BoolResult> delete(QueryParams params) async {
                            ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:198:20: Error: Method not found: 'BoolResult'.
    final result = BoolResult();
                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:198:20: Error: The method 'BoolResult' isn't defined for the class
'SqfEntityProvider'.
 - 'SqfEntityProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing method, or defining a method named
'BoolResult'.
    final result = BoolResult();
                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:212:7: Error: 'QueryParams' isn't a type.
      QueryParams params, Map<String, dynamic> values) async {
      ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:213:20: Error: Method not found: 'BoolResult'.
    final result = BoolResult();
                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:213:20: Error: The method 'BoolResult' isn't defined for the class
'SqfEntityProvider'.
 - 'SqfEntityProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing method, or defining a method named
'BoolResult'.
    final result = BoolResult();
                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:249:26: Error: 'BoolResult' isn't a type.
    final results = List<BoolResult>();
                         ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:252:22: Error: Method not found: 'BoolResult'.
      final result = BoolResult();
                     ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:252:22: Error: The method 'BoolResult' isn't defined for the class
'SqfEntityProvider'.
 - 'SqfEntityProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing method, or defining a method named
'BoolResult'.
      final result = BoolResult();
                     ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:269:26: Error: 'BoolResult' isn't a type.
    final results = List<BoolResult>();
                         ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:272:22: Error: Method not found: 'BoolResult'.
      final result = BoolResult(success: false);
                     ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:272:22: Error: The method 'BoolResult' isn't defined for the class
'SqfEntityProvider'.
 - 'SqfEntityProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing method, or defining a method named
'BoolResult'.
      final result = BoolResult(success: false);
                     ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:299:24: Error: 'SqfEntitySequenceBase' isn't a type.
  Future<int> sequence(SqfEntitySequenceBase seq, bool increase,
                       ^^^^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:333:22: Error: Getter not found: 'databaseTables'.
    databaseTables = databaseTables ?? [];
                     ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:333:5: Error: Setter not found: 'databaseTables'.
    databaseTables = databaseTables ?? [];
    ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:334:17: Error: Getter not found: 'sequences'.
    sequences = sequences ?? [];
                ^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:334:5: Error: Setter not found: 'sequences'.
    sequences = sequences ?? [];
    ^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:335:25: Error: Getter not found: 'sequences'.
    final dbSequences = sequences.where((i) => !i.initialized).toList();
                        ^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:343:12: Error: 'SqfEntitySequenceBase' isn't a type.
      for (SqfEntitySequenceBase sequence in dbSequences) {
           ^^^^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:357:22: Error: Getter not found: 'databaseTables'.
    final dbTables = databaseTables.where((i) => !i.initialized).toList();
                     ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:360:12: Error: 'SqfEntityTableBase' isn't a type.
      for (SqfEntityTableBase table in dbTables) {
           ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:364:20: Error: 'TableField' isn't a type.
        final List<TableField> exitingDBfields = List<TableField>();
                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:364:55: Error: 'TableField' isn't a type.
        final List<TableField> exitingDBfields = List<TableField>();
                                                      ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:380:17: Error: Method not found: 'parseDbType'.
                parseDbType(tableFields[i]['type'].toString())));
                ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:379:33: Error: Method not found: 'TableField'.
            exitingDBfields.add(TableField(tableFields[i]['name'].toString(),
                                ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:333:5: Error: The setter 'databaseTables' isn't defined for the class
'SqfEntityModelProvider'.
 - 'SqfEntityModelProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named
'databaseTables'.
    databaseTables = databaseTables ?? [];
    ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:333:22: Error: The getter 'databaseTables' isn't defined for the class
'SqfEntityModelProvider'.
 - 'SqfEntityModelProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named
'databaseTables'.
    databaseTables = databaseTables ?? [];
                     ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:334:5: Error: The setter 'sequences' isn't defined for the class
'SqfEntityModelProvider'.
 - 'SqfEntityModelProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named
'sequences'.
    sequences = sequences ?? [];
    ^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:334:17: Error: The getter 'sequences' isn't defined for the class
'SqfEntityModelProvider'.
 - 'SqfEntityModelProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named
'sequences'.
    sequences = sequences ?? [];
                ^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:335:25: Error: The getter 'sequences' isn't defined for the class
'SqfEntityModelProvider'.
 - 'SqfEntityModelProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named
'sequences'.
    final dbSequences = sequences.where((i) => !i.initialized).toList();
                        ^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:357:22: Error: The getter 'databaseTables' isn't defined for the class
'SqfEntityModelProvider'.
 - 'SqfEntityModelProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named
'databaseTables'.
    final dbTables = databaseTables.where((i) => !i.initialized).toList();
                     ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:379:33: Error: The method 'TableField' isn't defined for the class
'SqfEntityModelProvider'.
 - 'SqfEntityModelProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing method, or defining a method named
'TableField'.
            exitingDBfields.add(TableField(tableFields[i]['name'].toString(),
                                ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:380:17: Error: The method 'parseDbType' isn't defined for the class
'SqfEntityModelProvider'.
 - 'SqfEntityModelProvider' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing method, or defining a method named
'parseDbType'.
                parseDbType(tableFields[i]['type'].toString())));
                ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:466:35: Error: 'SqfEntityTableBase' isn't a type.
bool checkForIsReadyDatabase(List<SqfEntityTableBase> dbTables) {
                                  ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:475:32: Error: 'SqfEntityTableBase' isn't a type.
List<String> checkTableIndexes(SqfEntityTableBase table) {
                               ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:477:8: Error: 'SqfEntityFieldType' isn't a type.
  for (SqfEntityFieldType field in table.fields) {
       ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:478:18: Error: 'SqfEntityFieldRelationshipBase' isn't a type.
    if (field is SqfEntityFieldRelationshipBase) {
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:487:5: Error: 'SqfEntityTableBase' isn't a type.
    SqfEntityTableBase table, List<TableField> exitingDBfields) {
    ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:487:36: Error: 'TableField' isn't a type.
    SqfEntityTableBase table, List<TableField> exitingDBfields) {
                                   ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:494:32: Error: Getter not found: 'DbType'.
      if (!(newField.dbType == DbType.bool &&
                               ^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:495:47: Error: Getter not found: 'DbType'.
              eField.toList()[0].fieldType == DbType.numeric) &&
                                              ^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:504:32: Error: Getter not found: 'DbType'.
        if (newField.dbType == DbType.text &&
                               ^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:511:23: Error: 'SqfEntityFieldRelationshipBase' isn't a type.
      if (newField is SqfEntityFieldRelationshipBase) {
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:536:23: Error: 'SqfEntityTableBase' isn't a type.
  final tables = List<SqfEntityTableBase>();
                      ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:548:34: Error: 'SqfEntityFieldType' isn't a type.
    final exitingDBfields = List<SqfEntityFieldType>();
                                 ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:563:13: Error: Method not found: 'parseDbType'.
            parseDbType(tableFields[i]['type'].toString())));
            ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:561:29: Error: Method not found: 'SqfEntityFieldBase'.
        exitingDBfields.add(SqfEntityFieldBase(
                            ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:566:16: Error: Method not found: 'SqfEntityTableBase'.
    tables.add(SqfEntityTableBase()
               ^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:568:21: Error: Method not found: 'toCamelCase'.
      ..modelName = toCamelCase(tableName)
                    ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:571:13: Error: Getter not found: 'PrimaryKeyType'.
          ? PrimaryKeyType.integer_auto_incremental
            ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:572:13: Error: Getter not found: 'PrimaryKeyType'.
          : PrimaryKeyType.integer_unique
            ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:581:30: Error: Getter not found: 'DbType'.
            (field.dbType == DbType.integer ||
                             ^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:582:33: Error: Getter not found: 'DbType'.
                field.dbType == DbType.numeric)) {
                                ^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:586:75: Error: Getter not found: 'DeleteRule'.
              table.fields.add(SqfEntityFieldRelationshipBase(parentTable,DeleteRule.NO_ACTION
              )
                                                                          ^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:586:32: Error: Method not found: 'SqfEntityFieldRelationshipBase'.
              table.fields.add(SqfEntityFieldRelationshipBase(parentTable,DeleteRule.NO_ACTION
              )
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:597:10: Error: Method not found: 'ConvertedModel'.
  return ConvertedModel()
         ^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:599:19: Error: Method not found: 'toModelName'.
    ..modelName = toModelName(databaseName.replaceAll('.', ''), null)
                  ^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:525:7: Error: The setter 'bundledDatabasePath' isn't defined for the class
'BundledModelBase'.
 - 'BundledModelBase' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named
'bundledDatabasePath'.
    ..bundledDatabasePath = bundledDatabasePath
      ^^^^^^^^^^^^^^^^^^^
../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sqfen
tity.dart:526:7: Error: The setter 'databaseName' isn't defined for the class
'BundledModelBase'.
 - 'BundledModelBase' is from 'package:sqfentity/sqfentity.dart'
 ('../../../Andy/development/flutter/.pub-cache/hosted/pub.dartlang.org/sqfentity-1.1.1/lib/sq
 fentity.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named
'databaseName'.
    ..databaseName = databaseName;

problem in SqfEntityFieldRelationship

class SqfEntityFieldRelationship implements SqfEntityFieldType {
SqfEntityFieldRelationship(this.table, this.deleteRule,
{this.fieldName, this.defaultValue}) {
if (fieldName == null) {
fieldName = table.tableName +
table.primaryKeyName.substring(0, 1).toUpperCase() +
table.primaryKeyName.substring(1);

relationshipName = table.modelName;

}

}

when !(if (fieldName == null))
relationshipName = null
And there is exception :
E/flutter (13796): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method 'toLowerCase' was called on null.

Exception - Unable to load asset: null

Hi there,

I have defined my model, pretty much inspired by the example here.

Whenever I try to save data to any of my tables, I get an exception from the save() method of the class corresponding to the table.

I know this is scarce information but I was hoping someone would have an idea of something obvious that I am forgetting and would let me know.

Thanks is advance,

A.

...reopened: can't locate 'package:sqfentity/db/sqfEntityBase.dart

I followed exactly the linked description. Here's the header of the model that was created in the debug window:

'''

flutter: import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';
import 'package:sqfentity/db/sqfEntityBase.dart';

/*
These classes was generated by SqfEntity
To use these SqfEntity classes do following:

  • import Blockstrainingsscaling.dart into where to use
  • start typing Blockstrainingsscaling().select()... (add a few filters with fluent methods)...(add orderBy/orderBydesc if you want)...
  • and then just put end of filters / or end of only select() toSingle(blockstrainingsscaling) / or toList(blockstrainingsscalingList)
  • you can select one Blockstrainingsscaling or List by your filters and orders
  • also you can batch update or batch delete by using delete/update methods instead of tosingle/tolist methods
    Enjoy.. Huseyin Tokpunar
    */

'''
It still states the old imports and throws errors in the flutter editor pane.

Do we really need isSaved field in models?

I was using the custom constructor since I cannot use the generated constructors for project reasons. So I never changed isSaved and I got entry already exists exception.

Here is the current save method:

/// Saves the object. If the id field is null, saves as a new record and returns new id, if id is not null then updates record

/// Returns id
Future save() async {
if (id == null || id == 0 || !isSaved) {
id = await _mn....insert(this);
isSaved = true;
} else {
id = await _upsert();
}
return id;
}

why do you need the !isNotSaved part in this code? upsert should be simple as you wrote in the method description.

not.equals(true) doesn't count null

I have a boolean column, all raws with null value and I write select where I want to list all not true.
So I write:
select().myColumn.not.equals(true).toList().

Result: I have an empty list
Expected: the list should have objects with null value.

Is it possible to write sql so we don't have to write an additional check for null?

new iOS Error after upgrading to SQFEntity 1.1.1

After upgrading and changing the code to work again all works fine (except the test issue #23) on Android, on iOS however, I do get an error in Xcode in file FMDatabase.m line 893, evaluating the return arguments from a query

`
else {

    while (idx < queryCount) {
        
        if (arrayArgs && idx < (int)[arrayArgs count]) {
            obj = [arrayArgs objectAtIndex:(NSUInteger)idx];
        }
        else if (args) {
            obj = va_arg(args, id); **<--EXC_BAD_ACCESS (code=1, address=0x20)**
        }
        else {
            //We ran out of arguments
            break;
        }
        
        if (_traceExecution) {
            if ([obj isKindOfClass:[NSData class]]) {
                NSLog(@"data: %ld bytes", (unsigned long)[(NSData*)obj length]);
            }` 

The relevant variable values are:
args = (va_list) "\x15"
idx = (int) 0
queryCount = (int) 1
obj = (id) 0x0

The runner windows shows, that it happens during a call in the following flutter package:

(lldb) #10 0x00000001030e76f0 in __40-[SqflitePlugin handleQueryCall:result:]_block_invoke at /Users/marcel/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.6+4/ios/Classes/SqflitePlugin.m:376

This problem came with the new version, and I have no clue, how to debug this...

Predefined database

Hi,

Amazing ORM you've built here! Nice job!

I was wondering if it's possible to use a seperate database with static rows which would be updated only when an update to the application is pushed.
Think 1 mutable database for the user to manipulate, and 1 immutable (for the user at least) database which gets updated once in a while to provide new rows which can be used in the mutable database through a relationship.

I'm still new to the Flutter ecosystem, so apologies if something like this isn't possible or is impractical.

Unable to decode the JSON when the key of the first letter is capital letter.

Hello, I have the SqfEntityField which has the first letter is capital letter, and the JSON key of the first letter is capital letter. When I pass the JSON inside the function "fromJson" it does not decode the JSON because in model.g.dart, all the variable in the first letter is small letter. When I build the model, can you let the variable follow exactly the format of the JSON key?
image
image

How to add custom methods to generated classes

I have a Person with firstName and lastName and I would like to add a method getFullName. How I can do that?

I have done that by creating a separate class with method getFullMethod(Person), but it would be great to somehow do that without a helper class.

Thanks

FileSystemException

import existing database and generate model automatically throw this exception on convertDatabaseToModelBase function.
Exception has occurred.
FileSystemException (FileSystemException: Cannot open file, path = '/data/data/com.example.fitness_flutter/databases/calories.db' (OS Error: No such file or directory, errno = 2))

20

You have hit a bug in build_runner

D:\androidWork\githubflutter\sqfEntity>flutter pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 247ms

[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 9.1s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 688ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 0ms

[INFO] Running build...
[INFO] 1.0s elapsed, 0/1 actions completed.
[SEVERE] sqfentity_gen:property_sqfentity on lib/model/model.dart:

Invalid argument(s): Path must be absolute : dart:convert

You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues

NoSuchMethodError: The getter 'references' was called on null.
Receiver: null
Tried calling: references
dart:core Object.noSuchMethod
package:analyzer/src/summary2/linked_bundle_context.dart 22:47 new LinkedBundleContext
package:analyzer/src/dart/analysis/library_context.dart 407:11 LibraryContext._createElementFactory
package:analyzer/src/dart/analysis/library_context.dart 94:7 new LibraryContext
package:analyzer/src/dart/analysis/driver.dart 1439:29 AnalysisDriver._createLibraryContext
package:analyzer/src/dart/analysis/driver.dart 1380:28 AnalysisDriver._computeUnitElement.
package:analyzer/src/dart/analysis/performance_logger.dart 34:15 PerformanceLog.run
package:analyzer/src/dart/analysis/driver.dart 1378:20 AnalysisDriver._computeUnitElement
package:analyzer/src/dart/analysis/driver.dart 997:34 AnalysisDriver.performWork
package:analyzer/src/dart/analysis/driver.dart 1931:24 AnalysisDriverScheduler._run
package:analyzer/src/dart/analysis/driver.dart 1865:5 AnalysisDriverScheduler.start
package:build_resolvers/src/analysis_driver.dart 54:13 analysisDriver
package:build_resolvers/src/resolver.dart 138:18 new AnalyzerResolvers
package:build_runner_core/src/generate/options.dart 192:19 BuildOptions.create
package:build_runner/src/generate/build.dart 85:36 build
package:build_runner/src/entrypoint/build.dart 28:24 BuildCommand.run
package:args/command_runner.dart 197:27 CommandRunner.runCommand
package:args/command_runner.dart 112:25 CommandRunner.run.
dart:async new Future.sync
package:args/command_runner.dart 112:14 CommandRunner.run
package:build_runner/src/entrypoint/run.dart 24:31 run
.dart_tool\build\entrypoint\build.dart 25:22 main

pub failed (1)

D:\androidWork\githubflutter\sqfEntity>flutter pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 241ms

[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 9.1s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 686ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 0ms

[INFO] Running build...
[INFO] 1.0s elapsed, 0/1 actions completed.
[SEVERE] sqfentity_gen:property_sqfentity on lib/model/model.dart:

Invalid argument(s): Path must be absolute : dart:convert

You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues

NoSuchMethodError: The getter 'references' was called on null.
Receiver: null
Tried calling: references
dart:core Object.noSuchMethod
package:analyzer/src/summary2/linked_bundle_context.dart 22:47 new LinkedBundleContext
package:analyzer/src/dart/analysis/library_context.dart 407:11 LibraryContext._createElementFactory
package:analyzer/src/dart/analysis/library_context.dart 94:7 new LibraryContext
package:analyzer/src/dart/analysis/driver.dart 1439:29 AnalysisDriver._createLibraryContext
package:analyzer/src/dart/analysis/driver.dart 1380:28 AnalysisDriver._computeUnitElement.
package:analyzer/src/dart/analysis/performance_logger.dart 34:15 PerformanceLog.run
package:analyzer/src/dart/analysis/driver.dart 1378:20 AnalysisDriver._computeUnitElement
package:analyzer/src/dart/analysis/driver.dart 997:34 AnalysisDriver.performWork
package:analyzer/src/dart/analysis/driver.dart 1931:24 AnalysisDriverScheduler._run
package:analyzer/src/dart/analysis/driver.dart 1865:5 AnalysisDriverScheduler.start
package:build_resolvers/src/analysis_driver.dart 54:13 analysisDriver
package:build_resolvers/src/resolver.dart 138:18 new AnalyzerResolvers
package:build_runner_core/src/generate/options.dart 192:19 BuildOptions.create
package:build_runner/src/generate/build.dart 85:36 build
package:build_runner/src/entrypoint/build.dart 28:24 BuildCommand.run
package:args/command_runner.dart 197:27 CommandRunner.runCommand
package:args/command_runner.dart 112:25 CommandRunner.run.
dart:async new Future.sync
package:args/command_runner.dart 112:14 CommandRunner.run
package:build_runner/src/entrypoint/run.dart 24:31 run
.dart_tool\build\entrypoint\build.dart 25:22 main

pub failed (1)

migrations

this library can be support migrations?

Failed to use toJson method of a select

First of all my congratulations for the library, it is a very useful and well done work.

I created the test base you provided in the example and when trying to run await Product().select().toJson();; the program has the following problem

NoSuchMethodError: Class 'DateTime' has no instance method 'toJson'. Receiver: Instance of 'DateTime' Tried calling: toJson()

> it would be great to add a "toJson" function to each of the database table objects that are created in the model.

it would be great to add a "toJson" function to each of the database table objects that are created in the model.
It would make sending DB data via http api calls much easier.
Would you be interested in adding this, or would you like help with that?

Cheers

I have added toJson feature for object or selected (filtered) list
please update your project to 1.0.2 version and read changelog from: https://pub.dev/packages/sqfentity#-changelog-tab-

Originally posted by @hhtokpinar in #17 (comment)

flutter_test: sdk: flutter unable depends

Running "flutter pub get" in demo...
The current Dart SDK version is 2.5.0.

Because test >=0.12.0-beta.3 <1.3.0 requires SDK version >=1.8.0 <2.0.0-∞ and test >=1.3.0 <1.6.1 depends on stream_channel ^1.6.0, test >=0.12.0-beta.3 <1.6.1 requires stream_channel ^1.6.0.
And because test >=1.6.0 <1.6.5 depends on analyzer >=0.26.4 <0.37.0, test >=0.12.0-beta.3 <1.6.5 requires stream_channel ^1.6.0 or analyzer >=0.26.4 <0.37.0.
And because test >=1.6.4 <1.6.8 depends on test_api 0.2.6 and test >=1.6.8 depends on test_api 0.2.7, test >=0.12.0-beta.3 requires test_api 0.2.6 or 0.2.7 or stream_channel ^1.6.0 or analyzer >=0.26.4 <0.37.0.
And because every version of flutter_test from sdk depends on stream_channel 2.0.0 and every version of build_verify depends on test ^1.0.0, if build_verify any and flutter_test any from sdk then test_api 0.2.6 or 0.2.7 or analyzer >=0.26.4 <0.37.0.
And because every version of flutter_test from sdk depends on test_api 0.2.5 and sqfentity_gen 1.0.2+2 depends on analyzer ^0.38.2, one of build_verify any or flutter_test any from sdk or sqfentity_gen 1.0.2+2 must be false.
And because no versions of sqfentity_gen match >1.0.2+2 <2.0.0 and meicet_ble_device depends on sqfentity_gen ^1.0.2+2, build_verify is incompatible with flutter_test from sdk.
So, because meicet_ble_device depends on both flutter_test any from sdk and build_verify ^1.1.0, version solving failed.

The primary key name does not check properly

Hello, the condition for table.primaryKeyName.toLowerCase() has lower case, however the primaryKeyName does not have a lower case. For example, table.primaryKeyName value is "productguid" and the primaryKeyName value "productGuid" . Hence, it always return me the error. Can you check it out. Thank you.
Screenshot_1

Problem after upgrade to SqfEntity 1.0.2

Hello,

after upgrading to SqfEntity 1.02 and changing the Primary Key declaration to primaryKeyType= PrimaryKeyType.integer_auto_incremental in all of my tables, I receive an error ininitializing the DB:

I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [BlocksTrainingsScaling] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [Config] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [MasterTraining] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [MeasurementScaling] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [Patient] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [TableSide] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [SkiTrainingsScaling] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [Therapist] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [Training] initialized successfuly
I/flutter (20935): >>>>>>>>>>>>>>>>>>>>>>>>>>>> SqfEntityTable of [TrainingData] initialized successfuly
E/flutter (20935): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method 'where' was called on null.
E/flutter (20935): Receiver: null
E/flutter (20935): Tried calling: where(Closure: (SqfEntitySequence) => bool)
E/flutter (20935): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
E/flutter (20935): #1 SqfEntityModel.initializeDB (package:sqfentity/sqfentity.dart:2126:35)

get result from functions of class

in this code:

Product().Select().id.equals(5).toSingle( (product) {    print(product.toMap());});

how can i pass product data to out of class? for example:

Product p = Product().Select().id.equals(5).toSingle();

for example:

    Lesson xcccc = Lesson();


    Lesson().select().toSingle((lesson){
      xcccc = lesson;
      return;
    });

    print(xcccc);

xcccc is null

No encontre la libreria en el manejador de paquete PUB

buenos días el motivo de la presente es informarle que esta librería no aparece en los repositorio para sus instalación, lo cual es un poco frustrante por que me parece la mejor que he visto, y también agradecerle por haber creado esta librería que me parece muí útil.

Repeated Relationship methods.

Hi, When I provide two columns in a table that refers as foreign key to same table the generated code is giving me two relationship methods with same name and because of this the dart code does not compile. Is there a way I can customise the name of the relationship method?

import 'package:letter_app/models/db/table_user.dart';
import 'package:letter_app/service/db/sqf_entity_base.dart';

class TableLetter extends SqfEntityTable {
  static SqfEntityTable _instance;

  static SqfEntityTable get getInstance {
    if (_instance == null) _instance = TableLetter();
    return _instance;
  }

  TableLetter() {
    tableName = "letters";
    primaryKeyName = "id";
    modelName = "LetterDb";

    fields = [
      SqfEntityField("title", DbType.text),
      SqfEntityField("mailing_list_id", DbType.integer),
      SqfEntityField("cover_image_url", DbType.text),
      SqfEntityField("tele_url", DbType.text),
      SqfEntityField("share_url", DbType.text),
      SqfEntityField("expires_at", DbType.text),
      SqfEntityField("created_at", DbType.text),
      SqfEntityFieldRelationship(TableUser.getInstance, DeleteRule.CASCADE,
          fieldName: "receiver_id"),
      SqfEntityFieldRelationship(TableUser.getInstance, DeleteRule.CASCADE,
          fieldName: "sender_id")
    ];

    super.init();
  }
}

Generated Code

class LetterDb {
// Rest of the code removed because of brevity.
// RELATIONSHIPS
  getUserDb(VoidCallback userdb(UserDb o)) {
    UserDb().getById(receiver_id, (obj) {
      userdb(obj);
    });
  }
  getUserDb(VoidCallback userdb(UserDb o)) {
    UserDb().getById(sender_id, (obj) {
      userdb(obj);
    });
  }
  // END RELATIONSHIPS

Compile error in generated file

Hi,

Generated file now reports the compile error in method fromObjectList:

static Future<List> fromObjectList(Future<List> o) async {
final data = await o;
return usersList = User.fromMapList(data);
}

Error is: "error: Undefined name 'usersList'."

Allow manual naming of SqfEntityFieldRelationship columns

Currently, it appears that setting a field as an SqfEntityFieldRelationship will automatically set column name. For example, if our Company (with PK CompanyId) table has many Customers, the Customers FK field will be automatically named companyCompanyId. Changing the "fieldName" property of the SqfEntityFieldRelationship doesn't appear to do anything. It would be great if these field names could be generated manually.

Thoughts? I may just be misusing the tool.

Unable to generate code automatically

I need to change the code before I can use it. I need to change it back when I'm finished.

import 'package:sqfentity_base/sqfentity_base.dart';
//import 'package:sqfentity_gen/sqfentity_gen.dart';

fix is config ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.