This file contains 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
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
This file contains 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
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
This file contains 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
import 'dart:async'; | |
import 'package:bloc/bloc.dart'; | |
import 'package:meta/meta.dart'; | |
class BlocClosedWithoutYieldingStateException implements Exception {} | |
Future<T> waitForStateFromBloc<T>({ | |
@required Bloc bloc, | |
}) { |
This file contains 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
void main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
var databasesPath = await getDatabasesPath(); | |
var path = join(databasesPath, 'example.db'); | |
var database = await openDatabase(path, version: 1, onCreate: (db, version) async { | |
await db.execute('''CREATE TABLE MyTable ( | |
id INTEGER PRIMARY KEY, | |
name TEXT)'''); |
This file contains 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 _MyAppState extends State<MyApp> { | |
Database _database; | |
@override | |
void initState() { | |
super.initState(); | |
asyncInitState(); | |
} |
This file contains 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
import 'package:flutter_app_template/blocs/base_bloc.dart'; | |
import 'package:flutter_app_template/blocs/state_yielding_example_blocs/full_state_yielding_screen_bloc/full_state_yielding_screen_event.dart'; | |
import 'package:flutter_app_template/blocs/state_yielding_example_blocs/full_state_yielding_screen_bloc/full_state_yielding_screen_state.dart'; | |
class FullStateYieldingScreenBloc extends BaseBloc<FullStateYieldingScreenEvent, | |
FullStateYieldingScreenState> { | |
int _property1; | |
int _property2; | |
int _property3; |
This file contains 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 PartialStateYieldingScreenBloc extends BaseBloc< | |
PartialStateYieldingScreenEvent, PartialStateYieldingScreenState> { | |
int _property1; | |
int _property2; | |
int _property3; | |
@override | |
PartialStateYieldingScreenState get initialState { | |
this._property1 = 0; | |
this._property2 = 0; |