This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: 'org.jetbrains.kotlin.multiplatform' | |
| apply plugin: 'com.squareup.sqldelight' | |
| apply plugin: 'kotlinx-serialization' | |
| sqldelight { | |
| AccountingDB { | |
| packageName = "com.littlegnal.accountingmultiplatform" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| | | |
| |__android | |
| | |__app | |
| |__ios | |
| |__lib | |
| |__test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AccountingRepository(private val accountingDB: AccountingDB) { | |
| private val json: Json by lazy { | |
| Json(JsonConfiguration.Stable) | |
| } | |
| ... | |
| fun getMonthTotalAmount(yearAndMonthList: List<String>): String { | |
| val list = mutableListOf<GetMonthTotalAmount>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const val SQLDELIGHT_CHANNEL = "com.littlegnal.accountingmultiplatform/sqldelight" | |
| class SqlDelightManager( | |
| private val accountingRepository: AccountingRepository | |
| ) : CoroutineScope { | |
| ... | |
| fun methodCall(method: String, arguments: Map<String, Any>, result: (Any) -> Unit) { | |
| launch(coroutineContext) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| implementation project(":common") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity: FlutterActivity() { | |
| private val sqlDelightManager by lazy { | |
| val accountingRepository = AccountingRepository(Db.getInstance(applicationContext)) | |
| SqlDelightManager(accountingRepository) | |
| } | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| GeneratedPluginRegistrant.registerWith(this) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rootProject.buildDir = '../build' | |
| subprojects { | |
| project.buildDir = "${rootProject.buildDir}/${project.name}" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @UIApplicationMain | |
| @objc class AppDelegate: FlutterAppDelegate { | |
| lazy var sqlDelightManager: SqlDelightManager = { | |
| Db().defaultDriver() | |
| let accountingRepository = AccountingRepository(accountingDB: Db().instance) | |
| return SqlDelightManager(accountingRepository: accountingRepository) | |
| }() | |
| override func application( | |
| _ application: UIApplication, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SummaryBloc { | |
| SummaryBloc(this._db); | |
| final AccountingRepository _db; | |
| final _summaryChartDataSubject = | |
| BehaviorSubject<SummaryChartData>.seeded(...); | |
| final _summaryListSubject = | |
| BehaviorSubject<BuiltList<SummaryListItem>>.seeded(BuiltList()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SummaryPage extends StatefulWidget { | |
| @override | |
| State<StatefulWidget> createState() => _SummaryPageState(); | |
| } | |
| class _SummaryPageState extends State<SummaryPage> { | |
| final _summaryBloc = SummaryBloc(AccountingRepository.db); | |
| ... |
OlderNewer