Forum Replies Created
-
AuthorPosts
-
kendalanya saat membuat note baru serta edit note yang sudah ada, jika buat note baru data masuk ke firebase tapi tidak membuat id, jadi data yang di buat muncul di luar di firebase.
link githubnya coach
githubDecember 13, 2022 at 5:09 PM in reply to: error Bad state: Error: package has unmigrated dependencies. #190491solved couach..
solved coach, terima kasih
solved coach, terima kasih
hallo coach, setelah saya coba hasilnya masih sama itu coach.
hallo coach ada dua error berbeda
1. saat run pakai web base ( chrome ) errornya missingpluginexception ( no implementattion found for method getdatabasespath on channel com.tekartik.sqflite) sudah di restart masih tetep muncul2. saat run pakai emulator android errornya masih sama databaseException(no such table: notes ( code 1 AQLITE_ERROR):, while compiling: SELECT* FORM notes) SQL ‘SELECT * FORM notes’ args
saya cantumkan githubnya coach
notes appsiap coba saya lihat lagi videonya coach
import 'package:notes_app/models/note.dart'; import 'package:path/path.dart'; import 'package:sqflite/sqflite.dart'; class dataBaseHelper { static const TABLE_NOTES = 'notes'; static const TABLE_NOTES_ID = 'id'; static const TABLE_NOTES_NOTE = 'note'; static const TABLE_NOTES_TITLE = 'title'; static const TABLE_NOTES_ISPINNED = 'iSPinned'; static const TABLE_NOTES_UPDATEDAT = 'updated_at'; static const TABLE_NOTES_CREATEDAT = 'created_at'; static Future<Database> Init() async { final dpPath = await getDatabasesPath(); return openDatabase(join(dpPath, 'notes.db'), version: 1, onCreate: (newDb, version) { newDb.execute('''CREATE TABLE $TABLE_NOTES ( $TABLE_NOTES_ID TEXT PRIMARY KEY, $TABLE_NOTES_TITLE TEXT, $TABLE_NOTES_NOTE TEXT, $TABLE_NOTES_ISPINNED INTEGER, $TABLE_NOTES_UPDATEDAT TEXT, $TABLE_NOTES_CREATEDAT TEXT, )'''); }); } Future<List<Note>> GetAllNote() async { final db = await dataBaseHelper.Init(); final results = await db.query('notes'); List<Note> listNote = []; results.forEach((data) { listNote.add(Note.formDb(data)); }); return listNote; } Future<void> insertallNote(List<Note> listNote) async { final db = await dataBaseHelper.Init(); Batch batch = db.batch(); listNote.forEach((note) { batch.insert('note', note.toDb()); }); await batch.commit(); } }sudah sloved coach tidak jadi
August 2, 2022 at 10:58 PM in reply to: praktik provider par 3 ( error terakhir di rubah null ) #103521August 2, 2022 at 10:57 PM in reply to: praktik provider par 3 ( error terakhir di rubah null ) #103520August 1, 2022 at 7:33 AM in reply to: praktik provider par 3 ( error terakhir di rubah null ) #103316add_or_detail_screen.dart
import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:praktik_state_management/models/note.dart'; import 'package:praktik_state_management/provider/notes.dart'; import 'package:provider/provider.dart'; class addOrDetailScreen extends StatefulWidget { // const addNoteScreen({Key key}) : super(key: key); static const routeName = '/addOrDetalNoteScreen'; @override State<addOrDetailScreen> createState() => _addOrDetailScreenState(); } class _addOrDetailScreenState extends State<addOrDetailScreen> { Note _note = Note(id: null, title: '', note: '', updateAt: null, createAt: null); bool init = true; final _formKey = GlobalKey<FormState>(); void submitNote() { _formKey.currentState.save(); final now = DateTime.now(); _note = _note.copyWith(updateAt: now, createAt: now); final notesProvider = Provider.of<Notes>(context, listen: false); notesProvider.addNote(_note); Navigator.pop(context); print(_note.note); print(_note.title); } @override void didChangeDependencies() { if (init) { String id = ModalRoute.of(context).settings.arguments as String; _note = Provider.of<Notes>(context).getNote(id); init = false; } super.didChangeDependencies(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( actions: [TextButton(onPressed: submitNote, child: Text('Simpan'))]), body: SingleChildScrollView( child: Container( padding: EdgeInsets.all(10), child: Form( key: _formKey, child: Column( children: [ TextFormField( initialValue: _note.title, decoration: InputDecoration( hintText: 'Judul', border: InputBorder.none), onSaved: (value) { _note = _note.copyWith(title: value); }, ), TextFormField( initialValue: _note.note, decoration: InputDecoration( hintText: 'tulis catatan di sini!', border: InputBorder.none), onSaved: (value) { _note = _note.copyWith(note: value); }, maxLines: null, ), Text('terakhir dirubah ${_note.updateAt}'), ], )), ), ), ); } } -
AuthorPosts