Skip to content

HaraHQ/flutter_isar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

form_learn

A new Flutter project.

Getting Started

Step:

  • bikin folder models

  • bikin file contoh lib/models/todo.dart

    import 'package:isar/isar.dart';
    
    part 'todo.g.dart';
    
    @Collection()
    class Todos {
      Id id = Isar.autoIncrement;
      late String title;
      late String content;
    
      @Backlink(to: "todo")
      final category = IsarLink<TodoCategories>();
    }
  • bikin file contoh lib/models/todo_category.dart

    import 'package:form_learn/models/todo.dart';
    import 'package:isar/isar.dart';
    
    part 'todo-category.g.dart';
    
    @Collection()
    class TodoCategories {
      Id? id = Isar.autoIncrement;
      late String title;
    
      final todo = IsarLinks<Todos>();
    }
    
  • pada terminal jalankan: flutter pub run build_runner build --delete-conflicting-outputs --delete-conflicting-outputs : ini untuk replace model generated by Isar

  • selesai terminal nanti ada file yang kegenerate contoh todo.g.dart dan todo_category.g.dart

  • file diatas adalah auto generate jadi gak perlu di ubah2

  • bikin lib/isar_service.dart untuk mastiin nantinya main.dart bisa running service db nya Isar

  • attach lib/isar_service.dart pada main.dart

  • buat Future function di isar_service.dart

  • akses function tersebut di main.dart atau di halaman lain

  • contoh lain bisa di cek langsung pada file2 nya

About

proof test flutter dan isar

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published